Your boss says tables are how websites are built. Your boss also prints out
his email. This page has no layout tables, no <font> tags and
no spacer GIFs. Everything you see is decided by one external stylesheet.
01 Why plant in CSS?
Structure goes in the markup; presentation goes in the stylesheet. Keep them apart and a
redesign becomes a single file upload, your pages shrink by a third, and screen readers finally
hear headings instead of nested <td> soup.
“Markup is a promise about meaning. Style is a suggestion about looks.”
overheard at a web standards meetup, 2004
02 Pruning the markup
- Headings are
<h1>to<h3>, in order. No more<b><font size="4">. - Navigation is a list, because it is a list.
- Lowercase tags, quoted attributes, every element closed.
<br />included. - The logo is real text, swapped for a picture with
text-indent.
Hacks every gardener knows by heart
- The box model hack
- Internet Explorer 5 puts padding inside the width. Feed it one width, then hide the right one behind a parser bug.
- The clearfix
- Floats escape their parent. A generated
:afterblock withclear: bothpulls the parent back around them. - The double-margin float bug
- IE6 doubles the margin on a floated box. Add
display: inline; nobody else minds.
03 Submit a design
Download the XHTML and the sample CSS. You may change only the stylesheet and your own images. Make it beautiful, make it strange, make it validate. Then send it in.