Professional Documents
Culture Documents
Making the hard stuff fun & easy with YUI CSS
OSCON 07
r7
A-Grade browser support (supported and tested by Yahoo) Normalize all HTML elements to ensure
similar display across browsers. minutes, without two Advil.
class selector
http://flickr.com/photos/randomlyhumming/247604167/
The Files
reset.css normalizes margins, padding, etc. fonts.css sets font baseline & even scaling grids.css denes classes for preset height
and widths of div html elements
reset.css
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h 6,pre,form,fieldset,input,textarea,p,blockq uote,th,td {margin:0;padding:0;} table {border-collapse:collapse;borderspacing:0;} fieldset,img {border:0;} address,caption,cite,code,dfn,em,strong,th, var {font-style:normal;font-weight:normal;} ol,ul {list-style:none;}caption,th {textalign:left;} h1,h2,h3,h4,h5,h6 {font-size: 100%;font-weight:normal;} q:before,q:after {content:'';}abbr,acronym {border:0;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,field set,input,textarea,p,blockquote,th,td
fonts.css
body {font:13px arial,helvetica,clean,sansserif;*font-size:small;*font:x-small;} table {font-size:inherit;font:100%;} select, input, textarea {font:99% arial,helvetica,clean,sans-serif;} pre, code {font:115% monospace;*font-size: 100%;}body * {line-height:1.22em;}
Or link to les served from Yahoo! servers: (a combined le; minimized and
compressed served by Yahoo)
First, include YUI css les. Explicitly set h1, h2, p, etc. in your own
Either download, or serve from Yahoo
master.css
grids.css
woohoo this is the cool stuff!
<div id="doc"> <div id="hd"> Header </div> <div id="bd"> Body </div> <div id="ft"> Footer </div> * border colors have been applied for clarity </div>
<div id="doc" class="yui-t1"> <div id="hd"> Header </div> <div id="bd"> <div id="yui-main"> <div class="yui-b"> Main </div> </div> <div class="yui-b"> Side </div> </div> <div id="ft"> Footer </div> </div>
template classes .yui-t1 .yui-t2 .yui-t3 .yui-t4 .yui-t5 .yui-t6 .yui-t7 160px on left 180px on left 300px on left 180px on right 240px on right 300px on right One full-width column
http://flickr.com/photos/cayusa/477619516/
Doesnt matter if in
single/multiple les.
The Cascade
<link rel=stylesheet src=master.css ...> <link rel=stylesheet src=winter.css ...>
A Sense of Style
Use semantic names as much as
possible
#logo, .tagline, .thumbnail, #profile_gallery
Top 5 FAQ
in under 5 minutes!
Mimic table layouts without the table! margins Specic per-column do that!) & padding (Bet your tables cant Progressive downloading in oated column
layouts.
More positioning...
position: relative;
by default.
They can also be forced to do the opposite! Give a span a height and width by adding
display: block
<span></span>
Leave tables for large amounts of tabular data. Learn a solid table-replacement CSS
technique.
div.thumbnail { float: left; width: 100px; height: 100px; margin: 0 20px 20px 0; } <div <div <div <div class=thumbnail>!</div> class=thumbnail>!</div> class=thumbnail>!</div> class=thumbnail>!</div>
CSSViewer, Firebug (Firefox), Opera 9/Mini Dolor Sit Amet (OSX/Dashboard) Web Developers Handbook
http://www.alvit.de/handbook/
Thank you!
Slides
http://webchic.net/talks/yui
Yahoo Grids
http://developer.yahoo.com/yui/grids/
See it in action!
http://www.yellowbot.com http://www.webchic.net