Designing With CSS

140
D ESIGNING W ITH Daniel Reedy [email protected]

Transcript of Designing With CSS

Page 2: Designing With CSS

Daniel [email protected]

Page 3: Designing With CSS

Daniel [email protected]

CASCADING STYLE

Page 4: Designing With CSS

Daniel [email protected]

FLEXIBILITY

Page 5: Designing With CSS

Daniel [email protected]

FLEXIBILITYFLEXIBILITY

Page 6: Designing With CSS

Daniel [email protected]

SEPARATION OF COMPONENTSSEPARATION OF COMPONENTS

Page 7: Designing With CSS

Daniel [email protected]

index.html

screen.css

print.css

Page 8: Designing With CSS

Daniel [email protected]

Page 9: Designing With CSS

Daniel [email protected]

Page 10: Designing With CSS

Daniel [email protected]

+

Page 11: Designing With CSS

Daniel [email protected]

+ =

Page 12: Designing With CSS

Daniel [email protected]

CONSISTANCY

Page 13: Designing With CSS

Daniel [email protected]

CONSISTANCYCONSISTANCY

Page 14: Designing With CSS

Daniel [email protected]

BANDWIDTHBANDWIDTH

Page 15: Designing With CSS

Daniel [email protected]

PAGE REFORMATTINGPAGE REFORMATTING

Page 16: Designing With CSS

Daniel [email protected]

GETTING STARTED

Page 17: Designing With CSS

Daniel [email protected]

GETTING STARTEDGETTING STARTED

Page 18: Designing With CSS

Daniel [email protected]

EVEN THE PLAYING FIELDEVEN THE PLAYING FIELD

Page 19: Designing With CSS

Daniel [email protected]

RESET STYLE SHEETRESET STYLE SHEET

Page 20: Designing With CSS

Daniel [email protected]

RESET STYLE SHEET

Page 21: Designing With CSS

Daniel [email protected]

RESET STYLE SHEET

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; font-size: 100%; font-family: inherit; vertical-align: baseline;}/* remember to define focus styles! */:focus { outline: 0;}body {

line-height: 1; color: black; background: white;}ol, ul { list-style: none;}/* tables still need 'cellspacing="0"' in the markup */table { border-collapse: separate; border-spacing: 0;}caption, th, td { text-align: left; font-weight: normal;}blockquote:before, blockquote:after,q:before, q:after { content: "";}blockquote, q { quotes: "" "";}

http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/

Page 22: Designing With CSS

Daniel [email protected]

RESET STYLE SHEET

Page 23: Designing With CSS

Daniel [email protected]

GREAT WEB TYPOGRAPHY

Page 24: Designing With CSS

Daniel [email protected]

GREAT WEB TYPOGRAPHYGREAT WEB TYPOGRAPHY

Page 25: Designing With CSS

Daniel [email protected]

STATIC IMAGESSTATIC IMAGES

Page 26: Designing With CSS

Daniel [email protected]

SIFR 2.0SIFR 2.0

Page 27: Designing With CSS

Daniel [email protected]

EMBEDDED OPEN TYPEEMBEDDED OPEN TYPE

Page 28: Designing With CSS

Daniel [email protected]

@FONT-FACE@FONT-FACE

Page 29: Designing With CSS

Daniel [email protected]

Page 30: Designing With CSS

Daniel [email protected]

Page 31: Designing With CSS

Daniel [email protected]

@FONT-FACE

Page 32: Designing With CSS

Daniel [email protected]

@FONT-FACE

/* In your CSS file (e.g. typography.css) */

@font-face { font-family: "MinyaNouvelle"; src: url('http://localhost/fonts/minya-nouvelle-bd.otf') format("opentype");}

h1, h2, h3, h4, h5 { font-family: "MinyaNouvelle", sans-serif }

Page 33: Designing With CSS

Daniel [email protected]

@FONT-FACE

Page 34: Designing With CSS

Daniel [email protected]

Page 35: Designing With CSS

Daniel [email protected]

Page 38: Designing With CSS

Daniel [email protected]

CÚFON & @FONT-

<!-- // In the <HEAD> tags of your document --><script type="text/javascript"> $(document).ready(function() { if(!$.fontAvailable('MinyaNouvelle')) { Cufon.replace('h1', { fontFamily: “MinyaNouvelle” }); }});</script>

<!-- // Directly prior to the </BODY> tag. This is need for IE --><script type="text/javascript"> Cufon.now(); </script>

Font Available Plugin: http://code.google.com/p/jquery-

Page 40: Designing With CSS

Daniel [email protected]

Page 41: Designing With CSS

Daniel [email protected]

FRESH IDEAS ON WEB

Page 42: Designing With CSS

Daniel [email protected]

.WEBFONT

Page 43: Designing With CSS

Daniel [email protected]

.WEBFONT.WEBFONT

Page 44: Designing With CSS

Daniel [email protected]

TYPEKITTYPEKIT

Page 45: Designing With CSS

Daniel [email protected]

KERNESTKERNEST

Page 46: Designing With CSS

Daniel [email protected]

FONT DECKFONT DECK

Page 47: Designing With CSS

Daniel [email protected]

Page 48: Designing With CSS

Daniel [email protected]

LAYOUT

Page 49: Designing With CSS

Daniel [email protected]

Page 50: Designing With CSS

Daniel [email protected]

BOX MODEL

Page 51: Designing With CSS

Daniel [email protected]

Page 52: Designing With CSS

Daniel [email protected]

Page 53: Designing With CSS

Daniel [email protected]

Element 1Element 2Element 3Element 4Element 5Element 6

Page 54: Designing With CSS

Daniel [email protected]

Element 1

Page 55: Designing With CSS

Daniel [email protected]

Page 56: Designing With CSS

Daniel [email protected]

Page 57: Designing With CSS

Daniel [email protected]

C O N T E N T

Page 58: Designing With CSS

Daniel [email protected]

P A D D I N G

C O N T E N T

Page 59: Designing With CSS

Daniel [email protected]

P A D D I N GB O R D E R

C O N T E N T

Page 60: Designing With CSS

Daniel [email protected]

P A D D I N GB O R D E R

M A R G I N

C O N T E N T

Page 61: Designing With CSS

Daniel [email protected]

P A D D I N GB O R D E R

M A R G I N

C O N T E N T

T O P

R I G H T

B O T T O M

L E F T

Page 62: Designing With CSS

Daniel [email protected]

Page 63: Designing With CSS

Daniel [email protected]

UNITS OF

Page 64: Designing With CSS

Daniel [email protected]

PIXELS (PX)

Page 65: Designing With CSS

Daniel [email protected]

PIXELS (PX)PIXELS (PX)

Page 66: Designing With CSS

Daniel [email protected]

EM SPACE (EM)EM SPACE (EM)

Page 67: Designing With CSS

Daniel [email protected]

PERCENT (%)PERCENT (%)

Page 68: Designing With CSS

Daniel [email protected]

Page 69: Designing With CSS

Daniel [email protected]

ESTABLISH A

Page 70: Designing With CSS

Daniel [email protected]

ESTABLISH A

/* In your type CSS file (e.g. typography.css) */

body { font-size: 62.5%; /* This establishes a 10px = 1em ratio */}

Page 71: Designing With CSS

Daniel [email protected]

ESTABLISH A

/* In your type CSS file (e.g. typography.css) */

body { font-size: 62.5%; /* This establishes a 10px = 1em ratio */}

h1 { font-size: 2.4em; } /* 24px */h2 { font-size: 1.8em; } /* 18px */h3 { font-size: 1.4em; } /* 14px */

Page 72: Designing With CSS

Daniel [email protected]

ESTABLISH A

/* In your type CSS file (e.g. typography.css) */

body { font-size: 62.5%; /* This establishes a 10px = 1em ratio */}

h1 { font-size: 2.4em; } /* 24px */h2 { font-size: 1.8em; } /* 18px */h3 { font-size: 1.4em; } /* 14px */

/* In your layout CSS File (e.g. screen.css) */#header { height: 3em; } /* 30px */

Page 73: Designing With CSS

Daniel [email protected]

ESTABLISH A

Page 74: Designing With CSS

Daniel [email protected]

Page 75: Designing With CSS

Daniel [email protected]

WHICH ONE?

Page 76: Designing With CSS
Page 77: Designing With CSS
Page 78: Designing With CSS

Daniel [email protected]

Page 79: Designing With CSS

Daniel [email protected]

FLOATS

Page 80: Designing With CSS

Daniel [email protected]

Page 81: Designing With CSS

Daniel [email protected]

Page 82: Designing With CSS

Daniel [email protected]

box 1

box 2

Page 83: Designing With CSS

Daniel [email protected]

box 1 box 2

Page 84: Designing With CSS

Daniel [email protected]

box 1 box 2

Page 85: Designing With CSS

Daniel [email protected]

box 1 box 2<!-- // In your .html file --><div id=”box1”> <p>box 1</p></div><div id=”box2”> <p>box 2</p></div>

/* In your layout CSS File (e.g. screen.css) */

#box1 { float: left; margin-right: 1em; width: 3em; }

Page 86: Designing With CSS

Daniel [email protected]

box 1 box 2

Page 87: Designing With CSS

Daniel [email protected]

CSS FRAMEWORKS

Page 88: Designing With CSS

Daniel [email protected]

CSS FRAMEWORKSCSS FRAMEWORKS

Page 89: Designing With CSS

Daniel [email protected]

SPEED UP DEVELOPMENTSPEED UP DEVELOPMENT

Page 90: Designing With CSS

Daniel [email protected]

SIMPLIFY DESIGNSIMPLIFY DESIGN

Page 91: Designing With CSS

Daniel [email protected]

EASILY BREAKABLEEASILY BREAKABLE

Page 92: Designing With CSS

Daniel [email protected]

STRICT CONSTRAINTSSTRICT CONSTRAINTS

Page 93: Designing With CSS

Daniel [email protected]

Page 94: Designing With CSS

Daniel [email protected]

BLUEPRINT 960 GRID YAHOO

Page 95: Designing With CSS

Daniel [email protected]

960 GRID

Page 96: Designing With CSS

Daniel [email protected]

Page 97: Designing With CSS

Daniel [email protected]

RESET, TYPOGRAPHY, &

Page 98: Designing With CSS

Daniel [email protected]

Page 99: Designing With CSS

Daniel [email protected]

GRIDS

Page 100: Designing With CSS
Page 101: Designing With CSS
Page 102: Designing With CSS
Page 103: Designing With CSS

Daniel [email protected]

Page 104: Designing With CSS

Daniel [email protected]

PUTTING IT ALL TOGETHER

Page 105: Designing With CSS
Page 106: Designing With CSS
Page 107: Designing With CSS
Page 108: Designing With CSS
Page 109: Designing With CSS
Page 110: Designing With CSS
Page 111: Designing With CSS
Page 112: Designing With CSS
Page 113: Designing With CSS
Page 114: Designing With CSS
Page 115: Designing With CSS
Page 116: Designing With CSS

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> </head> <body> <div class="container_12"> <div class="grid_12"> <!-- // SIU Header --> </div> <div class="clear">&nbsp;</div> </div> <div id="housing_header" class="container_12"> <div class="grid_12 alpha omega"> <!-- // Navigation --> </div> <div class="prefix_8 grid_4 omega"> <!-- // Mission Statement --> </div> <div class="clear">&nbsp;</div> </div> <div id="page_content" class="container_12"> <div class="grid_4"> <!-- // Left Column --> </div> <div class="prefix_1 grid_4"> <!-- // Middle Column --> </div> <div class="grid_3 omega"> <!-- // Right Column --> </div> <div class="clear">&nbsp;</div> </div>

Page 117: Designing With CSS

Daniel [email protected]

Page 118: Designing With CSS

Daniel [email protected]

THE STYLE SHEETS

Page 119: Designing With CSS

Daniel [email protected]

THE STYLE SHEETS

Page 120: Designing With CSS

Daniel [email protected]

THE STYLE SHEETS

reset 960 typography layout colour

Page 121: Designing With CSS

Daniel [email protected]

THE STYLE SHEETS

reset 960 typography layout colour

screen print

Page 122: Designing With CSS

Daniel [email protected]

THE STYLE SHEETS

reset 960 typography layout colour

screen print

If Internet Explorer

ie7 ie6

Page 123: Designing With CSS

Daniel [email protected]

THE STYLE SHEETS

reset 960 typography layout colour

screen print

If Internet Explorer

ie7 ie6

Page 124: Designing With CSS
Page 125: Designing With CSS

/* colour.css */html { background: rgb(87,0,36); }a { color: rgb(14,117,138); }a:visted { color: rgb(110,5,101); }#siu_header, #siu_header a { color: rgb(132,128,111); }#mission { color: rgb(216,214,184); }#main_navigation, #main_navigation a, #footer_navigation, #footer_navigation a { color: rgb(255,255,255);}#columns, #columns a { color: rgb(87,0,36); }#copyright { color: rgb(255,255,255); }

/* typography.css */body { font-size:62.5%; } /* 1em = 10px */h1 { font-size:2.4em; } /* displayed at 24px */h2 { font-size:2.0em; } /* displayed at 20px */h3 { font-size:1.8em; } /* displayed at 18px */h4 { font-size:1.4em; } /* displayed at 14px */#page_content p { font-size:1.4em; line-height: 1.8em; margin-bottom: 1.8em;} /* displayed at 14px */#siu_header { font-size: 2.0em; text-align: center; letter-spacing: .5em; text-transform: uppercase; }#siu_header a { text-decoration: none; }#mission { font-size: 2.3em; letter-spacing: .04em; }#main_navigation, #footer_navigation { font-size: 1.5em; text-align: center; text-transform: uppercase;}#columns h2 { font-size: 1.8em; text-transform: uppercase; }#columns ul li { font-size: 1.4em; line-height: 1.8em;}#copyright { font-family: Helvetica, Verdana, Arial, sans-serif; font-size: .8em; letter-spacing: .1em; line-height: 1.6em;}.angelina { font-size: 1.8em; }

Page 126: Designing With CSS
Page 127: Designing With CSS
Page 128: Designing With CSS
Page 129: Designing With CSS
Page 130: Designing With CSS
Page 131: Designing With CSS
Page 132: Designing With CSS

<!-- // index.html --><div class="flyer"> <p> <a href="/contract/residence-halls/"> <img src="/images/housing_rocks.png" alt="Housing Rocks" /> </a> </p></div>

/* screen.css */.flyer { -webkit-transform: rotate(3deg); -moz-transform: rotate(3deg);}

Page 133: Designing With CSS

Daniel [email protected]

Page 134: Designing With CSS

Daniel [email protected]

WHAT’S NEW IN CSS3?

Page 135: Designing With CSS

Daniel [email protected]

Page 136: Designing With CSS

Daniel [email protected]

Q&A – CSS EVALUATION

Page 137: Designing With CSS

Daniel [email protected]

Page 138: Designing With CSS

Daniel [email protected]

THANK YOU!

Page 139: Designing With CSS

Daniel [email protected]

Page 140: Designing With CSS

Daniel [email protected]

ERIC MEYER RESET CSS: HTTP://MEYERWEB.COM/ERIC/THOUGHTS/2007/05/01/RESET-RELOADED/SCALABLE INMAN FLASH REPLACEMENT: HTTP://WWW.MIKEINDUSTRIES.COM/BLOG/SIFR/EMBEDDED OPEN TYPE (EOT) FONT TOOL: HTTP://WWW.MICROSOFT.COM/TYPOGRAPHY/WEFT.MSPXOVERVIEW OF @FONT-FACE: HTTPS://DEVELOPER.MOZILLA.ORG/INDEX.PHP?TITLE=EN/CSS/%40FONT-FACECÚFON: HTTP://WIKI.GITHUB.COM/SORCCU/CUFON/ABOUT.WEBFONT PROPOSAL HTTP://LISTS.W3.ORG/ARCHIVES/PUBLIC/WWW-FONT/2009JULSEP/0440.HTMLTYPE FOUNDRIES SUPPORTING .WEBFONT: HTTP://WWW.TYPOGRAPHER.ORG/2009/07/WEBFONT-PROPOSAL-GAINS-