<?xml version="1.0"?>

<rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
>

<channel rdf:about="http://simon.incutio.com/syndicate/csstutorial/rss1.0">
  <title>CSS ain't Rocket Science</title>
  <link>http://simon.incutio.com/</link>
  <description>Simon Willison's CSS ain't Rocket Science cateory</description>
  <language>en-uk</language>
  <webMaster>simon@incutio.com</webMaster>
  <items>
    <rdf:Seq>
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/06/17/gorgeousLinks" />
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/06/03/bookmarkletsAndCSS" />
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/05/27/funWithLinks" />
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/05/26/theBoxModel" />
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/05/23/tutorialFeedback" />
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/05/21/stylingBlockquotes" />
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/05/20/defeatingIE5" />
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/05/19/scriptingWithCSS" />
      <rdf:li rdf:resource="http://simon.incutio.com/archive/2003/05/18/anatomyOfAStylesheet" />
    </rdf:Seq>
  </items>
</channel>

<item rdf:about="http://simon.incutio.com/archive/2003/06/17/gorgeousLinks">
  <title>Gorgeous CSS Rollovers</title>
  <description>&lt;p&gt;I've been planning a follow-up to my &lt;a href=&quot;http://simon.incutio.com/archive/2003/05/27/funWithLinks&quot;&gt;basic link styling tutorial&lt;/a&gt; for over a week now, but it's going to be a lot shorter now thanks to Al Sparber's excellent &lt;a href=&quot;http://www.projectseven.com/tutorials/css_menus/list_01/&quot;&gt;Uberlink CSS Rollover tutorial&lt;/a&gt;, which covers a lot of useful concepts and ends up with a truly gorgeous looking result. Thoroughly recommended.&lt;/p&gt;</description>
  <link>http://simon.incutio.com/archive/2003/06/17/gorgeousLinks</link>
  <dc:subject>Graphic Design, CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-06-17T23:57:46-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>
<item rdf:about="http://simon.incutio.com/archive/2003/06/03/bookmarkletsAndCSS">
  <title>Using bookmarklets to experiment with CSS</title>
  <description>&lt;p&gt;I'm in the middle of a whole bunch of exams at the moment, but here's a quick tip that should make experimenting with and learning &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; a great deal easier. It involves bookmarklets. If you haven't seen them before, bookmarklets are bookmarks that embed javascript; when you click the bookmark, the javascript is executed in the context of the currently loaded page. What that means is that in a suitably advanced browser bookmarklets can be used to modify pages, analyse their structure and do a whole host of other useful things.&lt;/p&gt;

&lt;p&gt;A fair number of bookmarklets work in both &lt;acronym title=&quot;Internet Explorer&quot;&gt;IE&lt;/acronym&gt; and Gecko engine browsers, but the really interesting ones (at least as far as learning &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; is concerned) tend to be Gecko only. If you're serious about learning &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; it's well worth getting a Gecko browser at any rate - Gecko's &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; support is more standards compliant than anything else currently available, so I recommend designing for the standards with Gecko and tweaking to support &lt;acronym title=&quot;Internet Explorer&quot;&gt;IE&lt;/acronym&gt; afterwards. Some people advocate designing for IE because it has buggier support, but once you've seen the tools available for Gecko I think you'll agree it really is a superb development platform. If you don't have access to a Gecko engine browser (that means Mozilla, Netscape 7, Camino, or Phoenix/Firebird) go and grab &lt;a href=&quot;http://www.mozilla.org/projects/firebird/&quot; title=&quot;Mozilla Firebird Project&quot;&gt;Firebird&lt;/a&gt; - it's only a 6 &lt;acronym title=&quot;MegaByte&quot;&gt;MB&lt;/acronym&gt; download and is available for most major platforms.&lt;/p&gt;

&lt;p&gt;Now that you're tooled up with a good browser, drag the following links on to your links toolbar or add them as bookmarks:&lt;/p&gt;

&lt;ul&gt;
 &lt;li&gt;&lt;a href=&quot;javascript:(function(){function init(){var newline=unescape(&amp;quot;%&amp;quot;+&amp;quot;0A&amp;quot;);dead=false;oldCSS=null;x=opener;ta=document.f.ta;ta.select();ta.value=&amp;quot;/* Type CSS rules here and they will be applied&amp;quot;+newline+&amp;quot;to pages from '&amp;quot;+location.host+&amp;quot;'&amp;quot;+newline+&amp;quot;immediately as long as you keep this window open. */&amp;quot;+newline+newline;update();}function update(){try{if(!x||x.closed){ta.style.backgroundColor=&amp;quot;#ddd&amp;quot;;return;}x.bookmarkletStyleSheet;}catch(er){ta.style.backgroundColor=&amp;quot;#fdc&amp;quot;;setTimeout(update,150);dead=true;return;}if(dead){dead=false;ta.style.backgroundColor=&amp;quot;&amp;quot;;oldCSS=null;}if(!x.testStyles){var newSS;newSS=x.document.createElement(&amp;quot;link&amp;quot;);newSS.rel=&amp;quot;stylesheet&amp;quot;;newSS.type=&amp;quot;text/css&amp;quot;;x.document.getElementsByTagName(&amp;quot;head&amp;quot;)[0].appendChild(newSS);x.testStyles=newSS;oldCSS=null;}if(oldCSS!=ta.value){oldCSS=ta.value;if(window.opera)x.testStyles.href=&amp;quot;javascript:unescape('&amp;quot;+escape(ta.value)+&amp;quot;')&amp;quot;;else if(navigator.userAgent.indexOf(&amp;quot;MSIE&amp;quot;)!=-1)x.testStyles.href=&amp;quot;javascript:unescape('&amp;quot;+escape(escape(ta.value))+&amp;quot;')&amp;quot;;else x.testStyles.href=&amp;quot;data:text/css,&amp;quot;+escape(ta.value);}setTimeout(update,150);}y=window.open('','','resizable,width=500,height=300');y.document.write('&amp;lt;title&amp;gt;New CSS Style Sheet&amp;lt;/title&amp;gt;&amp;lt;style&amp;gt;.ec { width: 100%; height: 100%; border: none; margin: 0px; padding: 0px; }&amp;lt;/style&amp;gt;&amp;lt;body class=&amp;quot;ec&amp;quot;&amp;gt;&amp;lt;form name=&amp;quot;f&amp;quot; style=&amp;quot;margin: 0px;&amp;quot; class=&amp;quot;ec&amp;quot;&amp;gt;&amp;lt;textarea name=&amp;quot;ta&amp;quot; wrap=&amp;quot;soft&amp;quot; style=&amp;quot;margin: 0px; border: 0px; width:100%; height:100%;&amp;quot; class=&amp;quot;ec&amp;quot;&amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;script&amp;gt;'+update+init+'init();&amp;lt;'+'/script&amp;gt;');y.document.close();})()&quot;
&gt;test styles&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;javascript:(function(){function init(){var newline=unescape(&amp;quot;%&amp;quot;+&amp;quot;0A&amp;quot;),importCount=0,L=[];dead=false;oldCSS=null;x=opener;ta=document.f.ta;ta.select();if(x.editStyles){ta.value=x.editStyles.innerHTML;update();return;}ta.value=&amp;quot;/* Type CSS rules here and they will be applied&amp;quot;+newline+&amp;quot;to pages from '&amp;quot;+location.host+&amp;quot;'&amp;quot;+newline+&amp;quot;immediately as long as you keep this window open. */&amp;quot;+newline+newline;function add(s){if(!s.disabled){var y={sheet:s,readable:true,label:&amp;quot;Imported&amp;quot;,inline:false,shorturl:&amp;quot;&amp;quot;,fulltext:&amp;quot;&amp;quot;};try{for(var k=0,m;m=s.cssRules[k];++k)if(m.type==3)add(m.styleSheet);}catch(er){y.readable=false;}L.push(y);if(s.ownerNode){y.label=s.ownerNode.tagName.toUpperCase()+&amp;quot;-tag&amp;quot;;if(!s.ownerNode.getAttribute(&amp;quot;src&amp;quot;)&amp;amp;&amp;amp;!s.ownerNode.href)y.inline=true;}if(y.inline){y.label=&amp;quot;Inline &amp;quot;+y.label;y.fulltext=fix(s.ownerNode.innerHTML);}else if(s.href.substr(0,13)==&amp;quot;data:text/css&amp;quot;){y.shorturl=&amp;quot; contained in a data: URL&amp;quot;;y.fulltext=fix(unescape(s.href.slice(14)));}else{++importCount;y.importtext=&amp;quot;@import \&amp;quot;&amp;quot;+s.href+&amp;quot;\&amp;quot;;&amp;quot;;y.shorturl=&amp;quot; &amp;quot;+s.href.split('/').reverse()[0];if(!y.readable){y.fulltext=&amp;quot;/* Out-of-domain; imported above. */&amp;quot;;}else if(s.href.substr(0,5)!=&amp;quot;http:&amp;quot;){y.fulltext=&amp;quot;/* Non-http; imported above. */&amp;quot;;}else{var loadingText=&amp;quot;/* Loading (&amp;quot;+(L.length-1)+&amp;quot;) */&amp;quot;;y.fulltext=loadingText;var p=new XMLHttpRequest();p.onload=function(e){ta.value=ta.value.replace(y.importtext+newline,&amp;quot;&amp;quot;);y.fulltext=p.responseText;ta.value=ta.value.replace(loadingText,fix(y.fulltext));ta.value=ta.value.replace(firstNote+newline,&amp;quot;&amp;quot;);};p.open(&amp;quot;GET&amp;quot;,s.href);p.send(null);}}}}function fix(s){while((s[0]==newline)&amp;amp;&amp;amp;s.length&amp;gt;1)s=s.slice(1);while((s[s.length-1]==newline)&amp;amp;&amp;amp;s.length&amp;gt;1)s=s.substr(0,s.length-1);s=s.replace(/@import.*;/ig,function(){return &amp;quot;/* &amp;quot;+RegExp.lastMatch+&amp;quot; */&amp;quot;;});return s;}for(var i=0,ss;ss=x.document.styleSheets[i];++i)add(ss);var imports=&amp;quot;&amp;quot;,main=&amp;quot;&amp;quot;;var firstNote=&amp;quot;/**** Style sheets whose contents could be loaded were ****/&amp;quot;+newline+&amp;quot;/**** imported instead.  Rule order may be incorrect   ****/&amp;quot;+newline+&amp;quot;/**** as a result. ****/&amp;quot;+newline;if(importCount){ta.value+=firstNote;}for(var i=0;ss=L[i];++i){if(ss.importtext){imports+=ss.importtext+newline;}main+=&amp;quot;/**** &amp;quot;+ss.label+&amp;quot; style sheet&amp;quot;+ss.shorturl+&amp;quot; ****/&amp;quot;+newline;main+=newline;main+=ss.fulltext;main+=newline;main+=newline;main+=newline;}ta.value+=imports+newline+main;update();}function update(){try{if(!x||x.closed){ta.style.backgroundColor=&amp;quot;#ddd&amp;quot;;return;}x.editStyles;}catch(er){ta.style.backgroundColor=&amp;quot;#fdc&amp;quot;;setTimeout(update,150);dead=true;return;}if(dead){dead=false;ta.style.backgroundColor=&amp;quot;&amp;quot;;oldCSS=null;}if(!x.editStyles){var newSS;newSS=x.document.createElement(&amp;quot;style&amp;quot;);newSS.type=&amp;quot;text/css&amp;quot;;x.document.getElementsByTagName(&amp;quot;head&amp;quot;)[0].appendChild(newSS);x.editStyles=newSS;oldCSS=null;for(var i=0,ss;ss=x.document.styleSheets[i];++i)ss.disabled=true;}if(oldCSS!=ta.value){oldCSS=ta.value;x.editStyles.innerHTML=ta.value;}setTimeout(update,150);}y=open('','','resizable,scrollbars=yes,width=550,height=520');y.document.write('&amp;lt;title&amp;gt;Edit Styles&amp;lt;/title&amp;gt;&amp;lt;style&amp;gt;.ec { width: 100%; height: 100%; border: none; margin: 0px; padding: 0px; }&amp;lt;/style&amp;gt;&amp;lt;body class=&amp;quot;ec&amp;quot;&amp;gt;&amp;lt;form name=&amp;quot;f&amp;quot; style=&amp;quot;margin: 0px;&amp;quot; class=&amp;quot;ec&amp;quot;&amp;gt;&amp;lt;textarea name=&amp;quot;ta&amp;quot; wrap=&amp;quot;soft&amp;quot; style=&amp;quot;margin: 0px; border: 0px; width:100%; height:100%;&amp;quot; class=&amp;quot;ec&amp;quot;&amp;gt;&amp;lt;/textarea&amp;gt;&amp;lt;script&amp;gt;'+update+init+'init();&amp;lt;'+'/script&amp;gt;');y.document.close();})()&quot;
&gt;edit styles&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;javascript:(function(){function A(n,g){var p=n.parentNode,t=n.tagName;if(!p)return &amp;quot;&amp;quot;;if(!t)return A(p,g);var T=t.toUpperCase(),b=(T!=&amp;quot;TABLE&amp;quot;&amp;amp;&amp;amp;T!=&amp;quot;TBODY&amp;quot;&amp;amp;&amp;amp;T!=&amp;quot;THEAD&amp;quot;&amp;amp;&amp;amp;T!=&amp;quot;TR&amp;quot;),c=n.className,i=n.id;return A(p,' &amp;gt; ')+(b?T:T.toLowerCase())+(c?&amp;quot;.&amp;quot;+c:&amp;quot;&amp;quot;)+(i?&amp;quot;#&amp;quot;+i:&amp;quot;&amp;quot;)+(b?g:' ');}document.onmouseover=function(e){e=e?e:event;var s,g=e.target;g=g?g:e.srcElement;try{s=A(g,'');}catch(err){s=err.message;}window.status=s;return true;};window.status=A(document.documentElement,'');})()&quot;
&gt;ancestors&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;javascript:(function(){var i,x;for(i=0;x=document.styleSheets[i];++i)x.disabled=true;})();&quot;
&gt;zap style sheets&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;javascript:(function(){var H=[&amp;quot;bgcolor&amp;quot;,&amp;quot;bgColor&amp;quot;,&amp;quot;background&amp;quot;,&amp;quot;color&amp;quot;,&amp;quot;align&amp;quot;,&amp;quot;text&amp;quot;,&amp;quot;alink&amp;quot;,&amp;quot;vlink&amp;quot;],Y={FONT:1,CENTER:1},d=[],p; function R(N){var a,x,i,t; if(t=N.tagName){ t=t.toUpperCase(); for (i=0;a=H[i];++i)if(N.getAttribute(a))N.removeAttribute(a); for(i=0;x=N.childNodes[i];++i)R(x); if (Y[t])d.push(N); } } R(document.documentElement); for (i=0;N=d[i];++i) { p=N.parentNode; while(N.firstChild)p.insertBefore(N.firstChild,N); p.removeChild(N); } })()&quot;
&gt;zap presentational html&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;javascript:s=document.getElementsByTagName('STYLE'); ex=document.getElementsByTagName('LINK'); d=window.open().document; /*set base href*/d.open();d.close(); b=d.body; function trim(s){return s.replace(/^\s*\n/, '').replace(/\s*$/, ''); }; function iff(a,b,c){return b?a+b+c:'';}function add(h){b.appendChild(h);} function makeTag(t){return document.createElement(t);} function makeText(tag,text){t=makeTag(tag);t.appendChild(document.createTextNode(text)); return t;} add(makeText('style', 'iframe{width:100%;height:18em;border:1px solid;')); add(makeText('h3', d.title='Style sheets in ' + location.href)); for(i=0; i&amp;lt;s.length; ++i) { add(makeText('h4','Inline style sheet'  + iff(' title=&amp;quot;',s[i].title,'&amp;quot;'))); add(makeText('pre', trim(s[i].innerHTML))); } for (i=0; i&amp;lt;ex.length; ++i) { rs=ex[i].rel.split(' '); for(j=0;j&amp;lt;rs.length;++j) if (rs[j].toLowerCase()=='stylesheet') { add(makeText('h4','link rel=&amp;quot;' + ex[i].rel + '&amp;quot; href=&amp;quot;' + ex[i].href + '&amp;quot;' + iff(' title=&amp;quot;',ex[i].title,'&amp;quot;'))); iframe=makeTag('iframe'); iframe.src=ex[i].href; add(iframe); break; } } void 0&quot;
&gt;view style sheets&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;javascript:(function(){var newSS; newSS=document.createElement(&amp;quot;link&amp;quot;); newSS.rel=&amp;quot;stylesheet&amp;quot;; newSS.type=&amp;quot;text/css&amp;quot;; newSS.href = &amp;quot;http://www.cs.hmc.edu/~jruderma/block-structure.css&amp;quot;; document.documentElement.childNodes[0].appendChild(newSS); })();&quot;
&gt;show blocks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now give them a go. They're all useful, but by far the most useful for learning &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; are &lt;strong&gt;test styles&lt;/strong&gt; and &lt;strong&gt;edit styles&lt;/strong&gt;. &lt;strong&gt;test styles&lt;/strong&gt; opens a popup window in which you can type &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; rules that will be applied instantly to the page you are viewing, while &lt;strong&gt;edit styles&lt;/strong&gt; does the same thing but pre-populates the window with the style sheets of the current site, allowing you to edit them in place. &lt;strong&gt;ancestors&lt;/strong&gt; is also useful; it shows the element hierarchy of the element your mouse is currently over, which can help you see what selector you need to use to modify that element's style. I cannot emphasize enough how powerful this is for working with &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;; using &lt;strong&gt;test styles&lt;/strong&gt; I was able to &lt;a href=&quot;http://simon.incutio.com/archive/2003/04/09/halfHourRedesign&quot; title=&quot;Half Hour Redesign&quot;&gt;redesign this site&lt;/a&gt; entirely in less than half an hour!&lt;/p&gt;

&lt;p&gt;All of the above bookmarklets were written by Jesse Ruderman. Jesse has many more bookmarklets, all of which are available on &lt;a href=&quot;http://www.squarefree.com/bookmarklets/&quot; title=&quot;&gt;Jesse's Bookmarklets Site&quot;&gt;his site&lt;/a&gt;. The bookmarklets listed above are from his &lt;a href=&quot;http://www.squarefree.com/bookmarklets/webdevel.html&quot; title=&quot;Web Development Bookmarklets&quot;&gt;Web Development collection&lt;/a&gt; (which includes further descriptions of these and many others). Jesse's bookmarklets have saved me countless hours of development time, and I hope they can do the same for you.&lt;/p&gt;</description>
  <link>http://simon.incutio.com/archive/2003/06/03/bookmarkletsAndCSS</link>
  <dc:subject>DHTML and Javascript, CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-06-03T13:49:28-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>
<item rdf:about="http://simon.incutio.com/archive/2003/05/27/funWithLinks">
  <title>Fun with links</title>
  <description>&lt;p&gt;Yesterday we talked about the box model. Today we're going to put a small part of it to work, by investigating ways of styling links. Before getting stuck in, we need to talk a bit about &lt;dfn&gt;pseudo-selectors&lt;/dfn&gt; (also known as pseudo classes). The &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; specification defines pseudo classes as &quot;characteristics that cannot be deduced from the document tree&quot;, but in practise the only widely implemented psuedo selectors are those that apply to links. The key psuedo selectors for links are:&lt;/p&gt;

&lt;ul&gt;
 &lt;li&gt;&lt;code class=&quot;selector&quot;&gt;a:link&lt;/code&gt; applies to normal links (but not to &lt;code class=&quot;html&quot;&gt;&amp;lt;a name=&quot;&quot;&amp;gt;&lt;/code&gt; elements)&lt;/li&gt;
 &lt;li&gt;&lt;code class=&quot;selector&quot;&gt;a:visited&lt;/code&gt; applies to visited links&lt;/li&gt;
 &lt;li&gt;&lt;code class=&quot;selector&quot;&gt;a:active&lt;/code&gt; applies to active links (links that are currently being clicked on)&lt;/li&gt;
 &lt;li&gt;&lt;code class=&quot;selector&quot;&gt;a:hover&lt;/code&gt; applies to links that the mouse is currently positioned over&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is the last of these that we shall be focusing on. One of the first and most popular effects that emerged when Javascript became popular was the image rollover, where an image (generally used as part of a site's navigation) would change when the mouse was positioned over it. &lt;code class=&quot;selector&quot;&gt;a:hover&lt;/code&gt; allows us to achieve a similar effect using just &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;. The most striking change is to alter the background colour, as shown in &lt;a href=&quot;/code/css/links/basic.html&quot; title=&quot;Simple link example&quot;&gt;this example&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After yesterday's discussion of the box model, it seems we would be able to achieve a lot more with this effect if links were block level elements. We can use the &lt;code class=&quot;css&quot;&gt;display: block;&lt;/code&gt; property to &quot;promote&quot; a link to block level status, which allows us to achieve all kinds of groovy effects. Consider the following &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;div id=&quot;menu&quot;&amp;gt;
 &amp;lt;a href=&quot;/&quot;&amp;gt;Link 1&amp;lt;/a&amp;gt;
 &amp;lt;a href=&quot;/&quot;&amp;gt;Link 2&amp;lt;/a&amp;gt;
 &amp;lt;a href=&quot;/&quot;&amp;gt;Link 3&amp;lt;/a&amp;gt;
 &amp;lt;a href=&quot;/&quot;&amp;gt;Link 4&amp;lt;/a&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Left to its own devices, this would display as a rather uninteresting line of links. Add some &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; and we can make it look much more interesting:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div#menu {
  width: 5em;
  border: 1px solid red;
  border-bottom: none;
}

div#menu a {
  display: block;
  text-decoration: none;
  border-bottom: 1px solid red;
  background-color: white;
  color: red;
  padding: 0 0.2em;
}

div#menu a:hover {
  background-color: red;
  color: white;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A few things to note. Most importantly, the links inside the div are set to &lt;code class=&quot;css&quot;&gt;display: block&lt;/code&gt;. This causes them to &quot;stack up&quot; on top of each other, and also causes them to expand to be as wide as their containing box (which is why we have restricted its width to 5 ems). The menu border is set to 1px all the way round, but then the bottom border is turned off. This means that when we set a bottom border on the links themselves the very bottom link does not end up with a &lt;em&gt;double&lt;/em&gt; border. The result of the above &lt;a href=&quot;/code/css/links/block-level.html&quot; title=&quot;Block level links example&quot;&gt;can be seen here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;How about horizontal navigation? That can be achieved in a similar fashion, using the float property to position the links next to each other:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div#menu a {
  display: block;
  float: left;
  width: 5em;
  padding: 0 0.2em;
  margin-right: 1em;
  text-decoration: none;
  border: 1px solid red;
  background-color: white;
  color: red;
}

div#menu a:hover {
  background-color: red;
  color: white;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Check out &lt;a href=&quot;/code/css/links/block-level-floats.html&quot; title=&quot;Block level floated links example&quot;&gt;the result here&lt;/a&gt;. Now that the links are floated it is important they have an explicit width assigned to them. A margin-right is used to place a gap between the links. There is one caveat to this method: It is important that any following element (preferably one that spans the whole page) as &lt;code class=&quot;css&quot;&gt;clear: both;&lt;/code&gt; applied to it, or any text in that element will flow around the menu rather than appearing below it. This is one of the most common upsets caused by using floats, and exactly the thing the clear property is designed to solve.&lt;/p&gt;

&lt;p&gt;There is one problem with the technique described so far: accessibility. If you run the above examples through any accessibility checker they will flag up a warning that the links in the examples are seperated only by whitespace. Try disabling &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; or viewing the examples in a non-&lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; browser and you'll see that this could definitely cause confusion - the links are displayed on a single line with only a single space between each one. A solution is at hand in the form of the humble &amp;lt;span&amp;gt; element accompanied by the &lt;code class=&quot;css&quot;&gt;display: none&lt;/code&gt; property:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div#menu span {
  display: none;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;div id=&quot;menu&quot;&amp;gt;
 &amp;lt;a href=&quot;/&quot;&amp;gt;Link 1&amp;lt;/a&amp;gt;&amp;lt;span&amp;gt; | &amp;lt;/span&amp;gt;
 &amp;lt;a href=&quot;/&quot;&amp;gt;Link 2&amp;lt;/a&amp;gt;&amp;lt;span&amp;gt; | &amp;lt;/span&amp;gt;
 &amp;lt;a href=&quot;/&quot;&amp;gt;Link 3&amp;lt;/a&amp;gt;&amp;lt;span&amp;gt; | &amp;lt;/span&amp;gt;
 &amp;lt;a href=&quot;/&quot;&amp;gt;Link 4&amp;lt;/a&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here's a &lt;a href=&quot;/code/css/links/block-level-spans.html&quot; title=&quot;Block level floats with spans&quot;&gt;demonstration of the above&lt;/a&gt;. Note that it's identical to the previous example in &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; browsers; the separating pipes only show up when the &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; is not applied.&lt;/p&gt;</description>
  <link>http://simon.incutio.com/archive/2003/05/27/funWithLinks</link>
  <dc:subject>CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-05-27T23:58:05-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>
<item rdf:about="http://simon.incutio.com/archive/2003/05/26/theBoxModel">
  <title>Understanding the Box Model</title>
  <description>&lt;p&gt;Today's tutorial is going to be all theory. The box model is an inevitable part of CSS, and understanding it is critical if you want to do anything remotely interesting. Like most of CSS, it's a lot simpler than it sounds. Here it is:&lt;/p&gt;

&lt;p class=&quot;img&quot;&gt;&lt;img src=&quot;/images/2003/boxmodel.gif&quot; alt=&quot;The box model governs the way margins, padding and borders are applied to block level elements&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Before discussing the box model, it is important to understand the difference between &lt;dfn&gt;inline&lt;/dfn&gt; and &lt;dfn&gt;block level&lt;/dfn&gt; elements. Inline elements are things like links, &lt;code class=&quot;html&quot;&gt;&amp;lt;em&amp;gt;&lt;/code&gt;s and &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s - any element that appears &quot;inline&quot; in a piece of text without inserting any newlines. Block level elements on the other hand always start on a new line and cause any content following them to start on a new line as well. They include things like &lt;code class=&quot;html&quot;&gt;&amp;lt;p&amp;gt;&lt;/code&gt;, &lt;code class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt; and the various header tags. Block level elements can contain both block level and inline elements, but inline elements can only contain other inline elements. An inline element can be &quot;promoted&quot; to behave like a block level element using the &lt;code class=&quot;css&quot;&gt;display: block;&lt;/code&gt; property, and the reverse can be achieved using &lt;code class=&quot;css&quot;&gt;display: inline;&lt;/code&gt; - note however that doing this does not change the rules about what kind of elements something can contain. The box model principally applies to block level elements (although some of it works with inline elements as well).&lt;/p&gt;

&lt;p&gt;As you can see from the diagram, the box model deals with the width, margin, padding and border around an element. You can specify a width using the &lt;code class=&quot;css&quot;&gt;width&lt;/code&gt; property; width can be specified in pixels, ems or percentages (and other units as well but these are the most common) and applies to the area on the diagram labelled &quot;content area&quot;. It should be noted that the overall width of the box up to the borders (the dark grey area on the diagram) is actually the width, plus the left padding, plus the right padding, plus the width of the left and right borders.&lt;/p&gt;

&lt;p&gt;It is here that IE5 gets things wrong: in IE5, the width property applies to the width AND the padding AND the border. There are two solutions to this problem. The first is to use Tantek's &lt;a href=&quot;http://www.tantek.com/CSS/Examples/boxmodelhack.html&quot;&gt;box model hack&lt;/a&gt; to feed alternative width values to IE5 (we have used this previously to improve IE5's rendering of Verdana). The second is to avoid setting any padding or thick borders on blocks that have a width declared, instead relying on the margin of elements contained within that block to add the &lt;em&gt;illusion&lt;/em&gt; of padding. Which technique you use it up to you.&lt;/p&gt;

&lt;p&gt;Margins, borders and padding can be set separately for each side, or set all at once using shorthand properties.&lt;/p&gt;

&lt;p&gt;An important thing to understand is the difference between margin and padding. Obviously padding occurs inside the border and margin outside, but surely this means that either can be used to the same effect if no border is required. This is more or less true, but comes with a few caveats. Firstly, the area treated by elements nested within an element as the &quot;width&quot; of the element is the content area plus the padding - this becomes important later on when we start to look at positioning. Secondly, top and bottom margins have a special effect applied to them called margin collapse. Put simply, when two elements are positioned above and below each other the gap between them is the size of the largest margin, NOT the size of the combined margins. This becomes important when considering margins on paragraphs, where specifying a margin of 1em means you get a 1em gap between each paragraph, rather than 2ems due to the margins being added together.&lt;/p&gt;</description>
  <link>http://simon.incutio.com/archive/2003/05/26/theBoxModel</link>
  <dc:subject>CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-05-26T23:58:23-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>
<item rdf:about="http://simon.incutio.com/archive/2003/05/23/tutorialFeedback">
  <title>CSS Tutorial: feedback so far</title>
  <description>&lt;p&gt;My &lt;a href=&quot;http://simon.incutio.com/categories/csstutorial/&quot; title=&quot;CSS ain't Rocket Science&quot;&gt;CSS tutorial series&lt;/a&gt; has been getting some fantastic feedback, both in this blog's comments system and elsewhere. This entry will summarise the most useful feedback, acting as a kind of errata to the previous entries. Thanks to everyone who commented, there are too many to credit individually but you can see most of the points in their original format by browsing the comments attached to each entry.&lt;/p&gt;

&lt;h4&gt;&lt;a href=&quot;http://simon.incutio.com/archive/2003/05/18/anatomyOfAStylesheet&quot;&gt;The anatomy of a stylesheet&lt;/a&gt;&lt;/h4&gt;

&lt;ol&gt;
 &lt;li&gt;In one of the examples I specified a &lt;code class=&quot;css&quot;&gt;color&lt;/code&gt; property without a &lt;code class=&quot;css&quot;&gt;background-color&lt;/code&gt; property. This causes a warning when run through the &lt;a href=&quot;http://jigsaw.w3.org/css-validator/&quot;&gt;CSS validator&lt;/a&gt;, because it may lead to unreadable text if the user has configured their browser's user stylesheet in such a way that your applied colour becomes unreadable.&lt;/li&gt;
 &lt;li&gt;I failed to cover the &lt;dfn&gt;Universal Selector&lt;/dfn&gt;. This is an &lt;code class=&quot;css&quot;&gt;*&lt;/code&gt; in place of the element selector, and means &quot;any element&quot;. In fact, &lt;code class=&quot;css&quot;&gt;.classname&lt;/code&gt; and &lt;code class=&quot;css&quot;&gt;#idname&lt;/code&gt; are actually shorthands for &lt;code class=&quot;css&quot;&gt;*.classname&lt;/code&gt; and &lt;code class=&quot;css&quot;&gt;*#idname&lt;/code&gt;.&lt;/li&gt;
 &lt;li&gt;A couple of terminology points: &quot;internal stylesheets&quot; are better known as &quot;embedded stylesheets&quot; and the &quot;descendant selector&quot; is really called the &quot;descendant combinator&quot;.&lt;/li&gt;
 &lt;li&gt;&lt;code class=&quot;css&quot;&gt;div#main a:link&lt;/code&gt; is preferable to &lt;code class=&quot;css&quot;&gt;div#main a&lt;/code&gt; for selecting all links inside a specific div, as it will match only hyperlinks while &lt;code class=&quot;css&quot;&gt;div#main a&lt;/code&gt; would match &lt;code class=&quot;html&quot;&gt;&amp;lt;a name=&quot;anchor&quot;&amp;gt;&lt;/code&gt; points as well.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;&lt;a href=&quot;http://simon.incutio.com/archive/2003/05/19/scriptingWithCSS&quot;&gt;Scripting.com, with added CSS&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;This entry drew the greatest criticism for its extensive use of the Fahrner Image Replacement technique, which &lt;a href=&quot;http://stopdesign.com/articles/css/replace-text/#footnote1&quot; title=&quot;Footnote to Doug Bowman's &amp;quot;Using Background-Image to Replace Text&amp;quot;&quot;&gt;can cause accessibility problems&lt;/a&gt; and also has some browser compatibility problems. In particular, the purple permalink icons were not showing up in &lt;acronym title=&quot;Internet Explorer&quot;&gt;IE&lt;/acronym&gt;5/Mac, probably because the technique was being applied to an inline rather than a block-level element. I have prepared two alternative examples of the Scripting.com remake, one using a permalink image and one that uses &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; to style the '#' sign to appear small and purple: &lt;a href=&quot;/code/css/scripting/finished-hashimages.html&quot;&gt;Scripting.com with inline image permalinks&lt;/a&gt;, &lt;a href=&quot;/code/css/scripting/finished-hashstyles.html&quot;&gt;Scripting.com with styled purple hashes&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;&lt;a href=&quot;http://simon.incutio.com/archive/2003/05/20/defeatingIE5#comments&quot;&gt;Defeating IE5 CSS bugs with the help of jwz&lt;/a&gt;&lt;/h4&gt;

&lt;ol&gt;
 &lt;li&gt;Owen Brigg's &lt;a href=&quot;http://www.thenoodleincident.com/tutorials/typography/index.html&quot;&gt;Sane CSS text sizes&lt;/a&gt; was suggested as a useful text sizing tutorial.&lt;/li&gt;
 &lt;li&gt;Vincent Flanders commented that the teaching style of the course sacrificed instant availability of code for extensive explanations, when most people would probably just like to grab the code and run. The reason I'm explaining everything as I go along is that the hey to using &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; in a practical manner is to understand its limitations and the subtle browser bugs demonstrated by some modern browsers. Just providing code may teach people basic &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; faster, but the moment they try their site in IE5 they'll be stumped by the weird side effects. By explaining each workaround as and when I use it I hope to make the unpleasant surprises a bit less unpleasant.&lt;/li&gt;
 &lt;li&gt;&lt;a href=&quot;http://randomfoo.net/?p=2003_04_27_archive.inc&quot;&gt;Leonard Lin&lt;/a&gt; (broken permalink, try the front page) commented that this article essentially proved jwz right in that &quot;CSS is too fuckin' hard&quot;. He's got a fair point, but I believe that for more people to successfully adopt &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; they need to be fully exposed to it, warts and all. The jwz example shows off &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; at its worst, but despite the hacks the result is still smaller, more structural and more maintainable than the original. Designs without centered blocks or using a font other than verdana would have avoided the hacks entirely.&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;&lt;a href=&quot;http://simon.incutio.com/archive/2003/05/21/stylingBlockquotes&quot;&gt;Quick tip: Styling blockquotes with CSS&lt;/a&gt;&lt;/h4&gt;

&lt;p&gt;Most of the comments here involved alternative ways of applying the selectors, all of which are worth reading about but none of which are practical due to poor browser support. I recommend reading them anyway, as they give a good indication of how much cleaner &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; will be once Microsoft &lt;a href=&quot;http://www.saila.com/columns/rants/030523.shtml&quot; title=&quot;Browser bug swatting&quot;&gt;get their act together&lt;/a&gt;.&lt;/p&gt;</description>
  <link>http://simon.incutio.com/archive/2003/05/23/tutorialFeedback</link>
  <dc:subject>CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-05-23T23:59:27-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>
<item rdf:about="http://simon.incutio.com/archive/2003/05/21/stylingBlockquotes">
  <title>Quick tip: Styling blockquotes with CSS</title>
  <description>&lt;p&gt;Today's tutorial is going to be short one, as I'm working on one last piece of coursework. This time I'm going to explain a clever &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; trick borrowed from &lt;a href=&quot;http://www.frejol.org/&quot;&gt;Nick Boalch&lt;/a&gt;. Here's a screenshot:&lt;/p&gt;

&lt;p class=&quot;img&quot;&gt;&lt;img src=&quot;/code/css/boalch/blockquotes.gif&quot; alt=&quot;The blockquote has large quote mark images surrounding it&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here's the &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;blockquote cite=&quot;http://www.w3.org/TR/REC-html40/struct/tables.html#h-11.1&quot;&amp;gt;
&amp;lt;div&amp;gt;
Tables should not be used purely as a means to layout document content as 
this may present problems when rendering to non-visual media. 
Additionally, when used with graphics, these tables may force users to 
scroll horizontally to view a table designed on a system with a larger 
display. To minimize these problems, authors should use style sheets to 
control layout rather than tables.
&amp;lt;/div&amp;gt;
&amp;lt;/blockquote&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt; in the above code is a slight sticking point: it has no structural value but is required for the technique to work. This is a trade off between 100% structural purity and presentational effects but I think it is one that is worth making.&lt;/p&gt;

&lt;p&gt;Here's the relevant &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;blockquote {
  background: transparent url(quoleft.png) left top no-repeat;
}
blockquote div {
  padding: 0 48px;
  background: transparent url(quoright.png) right bottom no-repeat;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There's a simple trick at work here. &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; backgrounds are extremely powerful but in &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;2 only one background can be applied to any single element. The blockquote effect requires two background images, one for the quote mark on the left hand side and one for the one on the right. The additional nested &lt;code class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt; allows us to do this, by applying one background image to the &lt;code class=&quot;html&quot;&gt;&amp;lt;blockquote&amp;gt;&lt;/code&gt; and one to the &lt;code class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The padding is applied to the &lt;code class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt; rather than the &lt;code class=&quot;html&quot;&gt;&amp;lt;blockquote&amp;gt;&lt;/code&gt; because the &lt;code class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt; needs to stretch the entire width of the &lt;code class=&quot;html&quot;&gt;&amp;lt;blockquote&amp;gt;&lt;/code&gt; in order for the background image to appear in the right place. The images are 38 pixels wide, so a padding is applied to the left and right hand sides of the &lt;code class=&quot;html&quot;&gt;&amp;lt;div&amp;gt;&lt;/code&gt; to allow space for the images and give an extra 10 pixels of whitespace.&lt;/p&gt;

&lt;p&gt;You can see the technique being used on &lt;a href=&quot;http://simon.incutio.com/code/css/boalch/blockquote.html&quot; title=&quot;Funky Blockquotes&quot;&gt;this sample page&lt;/a&gt;, or over on &lt;a href=&quot;http://www.frejol.org/&quot;&gt;Nick's weblog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One final note: while it's tempting to add &lt;code&gt;font-style: italic&lt;/code&gt; to blockquotes, doing so may cause a &lt;a href=&quot;http://simon.incutio.com/archive/2003/04/09/italicBlockquotesCauseScrollba&quot;&gt;horizontal scrollbar to appear&lt;/a&gt; in &lt;acronym title=&quot;Internet Explorer&quot;&gt;IE&lt;/acronym&gt;6/Windows. Strange but true.&lt;/p&gt;

&lt;p&gt;Incidentally, I've been getting some absolutely fantastic feedback on this series on the comments attached to each entry - please keep it coming! The feedback has included a number of suggested improvements and other worthwhile tips. Rather than editing the original articles I plan to use tomorrow's update to revisit the previous day's articles and update them based on suggestions from the comments.&lt;/p&gt;</description>
  <link>http://simon.incutio.com/archive/2003/05/21/stylingBlockquotes</link>
  <dc:subject>CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-05-21T23:54:22-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>
<item rdf:about="http://simon.incutio.com/archive/2003/05/20/defeatingIE5">
  <title>Defeating IE5 CSS bugs with the help of jwz</title>
  <description>&lt;p&gt;Today's &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; case study will be &lt;a href=&quot;http://www.livejournal.com/~jwz/&quot;&gt;Jamie Zawinski's LiveJournal&lt;/a&gt;. OK, I admit that he's something of a tempting target after his widely publicised &lt;a href=&quot;http://www.livejournal.com/~jwz/193866.html&quot;&gt;CSS rant&lt;/a&gt; last month (which was the main inspiration for this course), but there are a number of sensible reasons his site makes a good case study as well. The theme for today is &quot;bugs in IE5 for Windows&quot;, and jwz's site offers two classic examples that fit this theme nicely. The first is the fact that the design is centered on the page, and the second is his choice of Verdana, a font which requires some trickery to get working well in IE5. In addition, the design of the entries seems to be a natural fit for a table based layout, so demonstrating how much simpler the code can be in &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; will hopefully turn a few heads.&lt;/p&gt;

&lt;p&gt;Here's the &quot;before&quot; screenshot:&lt;/p&gt;

&lt;p class=&quot;img&quot;&gt;&lt;img src=&quot;/code/css/jwz/jwz.gif&quot; alt=&quot;Life isn't fun 24 hours a day...&quot; longdesc=&quot;http://www.livejournal.com/~jwz/203141.html&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And here's the original HTML (I've added some newlines but other than that it's as seen on the page):&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;
&amp;lt;table summary=&quot;&quot; border=&quot;0&quot; cellpadding=&quot;2&quot; class=&quot;entrybox&quot; width=&quot;600&quot; 
cellspacing=&quot;0&quot;&amp;gt;
&amp;lt;tr align=&quot;left&quot;&amp;gt;
&amp;lt;td align=&quot;center&quot; bgcolor=&quot;#00CC00&quot;&amp;gt;
&amp;lt;table summary=&quot;&quot; border=&quot;0&quot; cellpadding=&quot;5&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot;&amp;gt;

&amp;lt;tr align=&quot;left&quot;&amp;gt;
&amp;lt;td class=&quot;caption&quot;&amp;gt;Life isn't fun 24 hours a day, so shopping should be.&amp;lt;/td&amp;gt;
&amp;lt;td class=&quot;index&quot; align=&quot;right&quot;&amp;gt;[18&amp;amp;nbsp;May&amp;amp;nbsp;2003|&amp;lt;b&amp;gt;04:09pm&amp;lt;/b&amp;gt;]&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr align=&quot;left&quot;&amp;gt;
&amp;lt;td bgcolor=&quot;#000000&quot; colspan=&quot;2&quot;&amp;gt;

&amp;lt;table summary=&quot;&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class=&quot;meta&quot;&amp;gt;[&amp;lt;/td&amp;gt;

&amp;lt;td class=&quot;meta&quot; align=&quot;right&quot;&amp;gt;&amp;lt;b&amp;gt;music&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;td class=&quot;meta&quot; align=&quot;center&quot;&amp;gt;|&amp;lt;/td&amp;gt;
&amp;lt;td class=&quot;meta&quot;&amp;gt;Luscious Jackson -- Bam Bam&amp;lt;/td&amp;gt;
&amp;lt;td class=&quot;meta&quot;&amp;gt;]&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;

&amp;lt;/table&amp;gt;&amp;lt;p&amp;gt;
&amp;lt;p&amp;gt;&amp;lt;a href=&quot;
http://www.nytimes.com/2003/05/18/magazine/18TOKYO.html?8hpib=&amp;amp;amp;pagewanted=all&quot;&amp;gt;
The Economy of Cool&amp;lt;/a&amp;gt; &amp;lt;p&amp;gt; Katayama has a dozen or so interiors to his credit in 
Harajuku-Aoyama, Tokyo's fashion and design district. All within walking distance 
of one another, they are boutiques that, in almost every case, aggressively cater 
to a youthful clientele for whom shopping is an adored cultural pursuit. ''You're 
not just buying the product,'' Katayama says. ''You're also buying the time you 
spend.'' [...] &amp;lt;p&amp;gt; Now 36, Masamichi Katayama studied interior design in Osaka, 
although he is quick to point out that it was strictly technical training, with 
no theoretical or academic courses. ''I learned the philosophy of what I do by 
shopping,'' he says. ''I'm a consumer first and foremost. Life isn't fun 24 hours 
a day, so shopping should be.'' He lights cigarette after cigarette as he speaks, 
taking no more than three drags on each before moving on to the next. [...] &amp;lt;p&amp;gt;

&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class=&quot;comments&quot; width=&quot;100%&quot; align=&quot;right&quot; bgcolor=&quot;#004400&quot; colspan=&quot;2&quot;&amp;gt;
&amp;lt;a href=&quot;http://www.livejournal.com/~jwz/203141.html&quot;&amp;gt;&amp;lt;b&amp;gt;2 comments&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;|
&amp;lt;a href=&quot;http://www.livejournal.com/~jwz/203141.html?mode=reply&quot;&amp;gt;post comment&amp;lt;/a&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;
&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's three tables for every entry on the page. If we trim it down to basic structural HTML, we get the following:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;div class=&quot;entry&quot;&amp;gt;
&amp;lt;p class=&quot;date&quot;&amp;gt;[18 May 2003|&amp;lt;strong&amp;gt;04:09pm&amp;lt;/strong&amp;gt;]&amp;lt;/p&amp;gt;
&amp;lt;h2&amp;gt;Life isn't fun 24 hours a day, so shopping should be.&amp;lt;/h2&amp;gt;
&amp;lt;p class=&quot;music&quot;&amp;gt;[&amp;lt;strong&amp;gt;music&amp;lt;/strong&amp;gt;|Luscious Jackson -- Bam Bam]
&amp;lt;p&amp;gt;&amp;lt;a href=&quot;
http://www.nytimes.com/2003/05/18/magazine/18TOKYO.html?8hpib=&amp;amp;amp;pagewanted=all&quot;&amp;gt;
 The Economy of Cool&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Katayama has a dozen or so interiors to his credit in Harajuku-Aoyama,
Tokyo's fashion and design district. All within walking distance of one
another, they are boutiques that, in almost every case, aggressively
cater to a youthful clientele for whom shopping is an adored cultural
pursuit. ''You're not just buying the product,'' Katayama says.
''You're also buying the time you spend.'' [...] &amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;Now 36, Masamichi Katayama studied interior design in Osaka, although he is
quick to point out that it was strictly technical training, with no
theoretical or academic courses. ''I learned the philosophy of what I
do by shopping,'' he says. ''I'm a consumer first and foremost. Life
isn't fun 24 hours a day, so shopping should be.'' He lights cigarette
after cigarette as he speaks, taking no more than three drags on each
before moving on to the next. [...] &amp;lt;/p&amp;gt;

&amp;lt;p class=&quot;comments&quot;&amp;gt;
&amp;lt;a href=&quot;http://www.livejournal.com/%7Ejwz/203141.html&quot; class=&quot;count&quot;&amp;gt;2 comments&amp;lt;/a&amp;gt;
|&amp;lt;a href=&quot;http://www.livejournal.com/%7Ejwz/203141.html?mode=reply&quot;&amp;gt;post comment&amp;lt;/a&amp;gt;
&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's quite a substantial reduction in markup. Here's &lt;a href=&quot;/code/css/jwz/jwz-unstyled.html&quot; title=&quot;jwz restructured and unstyled&quot;&gt;what it looks like&lt;/a&gt;. The challenge now is to make it look like it does in the picture.&lt;/p&gt;

&lt;p&gt;First, let's set a few basic rules. JWZ's site has green text on a black background, both of which should be set as rules on the document body (they could be set on individual elements but since they apply to the whole document it's best to define them higher up):&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;body {
  background-color: #000;
  color: #0f0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that while the original site uses #000000 and #00FF00 as hexadecimal colour attributes on the body tag, I have used #000 and 
#0f0. Since many common colours can be represented using three pairs of hexadecimal digits, &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; allows you to use three instead of six and will &quot;double&quot; each digit in its place. &lt;code&gt;color: #00ff00;&lt;/code&gt; would have exactly the same effect.&lt;/p&gt;

&lt;h4&gt;Setting the font size (IE bug #1)&lt;/h4&gt;

&lt;p&gt;Now it's time to tackle our first IE5/Windows specific bug. Verdana is an extremely popular font among web designers, but suffers from the unfortunate problem that it is sinfully ugly when displayed at the browser's default text size. Knock it down just one size and it becomes a great deal pretty, while remaining completely readable. As a result, if we want to use Verdana we really need to make it smaller.&lt;/p&gt;

&lt;p&gt;&lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; provides a truly huge range of font sizing options, and each and every one of them carries its own set of flaws and limitations thanks to differences in implementation between the many &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; supporting browsers. A good resource for understanding the scope of this problem is Owen Brigg's excellent &lt;a href=&quot;http://www.thenoodleincident.com/tutorials/box_lesson/font/&quot;&gt;Text Sizing article&lt;/a&gt;, which includes 274 screenshots of different font sizing techniques in different environments. To cut a long story short, the only reliable cross browser sizing method is to specify the size of the font in pixels. This comes with one massive drawback: doing so will prevent IE users from resizing the text in their browsers. If you care at all about accessibility you'll know why this is a bad idea.&lt;/p&gt;

&lt;p&gt;No matter which font sizing technique you use, it is widely recognised that the best way of dealing with font sizes is to set a single basic font size on the body and then size other text on the page relative to that initial size using ems (described briefly last tutorial) or percentages. Personally, I like to use a font such as Georgia which looks good at the default browser size setting and avoid the whole issue of setting an initial size, but as we have already discussed if you are using Verdana this is pretty much out of the question. When forced to resize the default font, my favoured method is to use the font-size keywords &lt;code class=&quot;css&quot;&gt;small&lt;/code&gt; and &lt;code class=&quot;css&quot;&gt;x-small&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This is where the IE5 bug comes in. Most browsers (including IE6 in standards mode, all Gecko engine browsers and Opera 7) display Verdana at the size I prefer if you specify &lt;code&gt;font-size: small&lt;/code&gt;. IE5 for Windows on the other hand requires &lt;code&gt;font-size: x-small&lt;/code&gt;. Since IE5 still has a relatively large market share, it's important to get things looking good in that browser, no matter how irritating it's support of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;. It's time to apply a &lt;dfn&gt;hack&lt;/dfn&gt;...&lt;/p&gt;

&lt;p&gt;Hacks are something of a controversial issue within the &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; community. Some people see them as an anathema to everything that &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; is meant to represent, while others (myself included) see them as a slightly unpleasant tool that can help achieve a practical end. Since the focus of this tutorial is on the practical applications of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;, I'll leave discussions of the validity of hacks to the &lt;a href=&quot;http://css-discuss.incutio.com/?page=ToHackOrNotToHack&quot; title=&quot;To hack or not to hack&quot;&gt;css-discuss wiki&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The hack I shall be using here is the famous &lt;a href=&quot;http://www.tantek.com/CSS/Examples/boxmodelhack.html&quot;&gt;Box Model Hack&lt;/a&gt; by Tantek Celik. Originally devised to get around a serious flaw in IE's implementation of the box model (to be covered later in the course), the box model hack allows a &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; author to feed one value to IE5 and another to better, more standards compliant browsers. We want to give IE5 &lt;code&gt;x-small&lt;/code&gt; and everything else &lt;code&gt;small&lt;/code&gt;, and here's the code we are going to use:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;body {
  background-color: #000;
  color: #0f0;
  font-family: verdana, sans-serif;
  font-size: x-small;
  voice-family: &quot;\&quot;}\&quot;&quot;;
  voice-family: inherit;
  font-size: small;
}
html&gt;body {
  font-size: small;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Ugly, isn't it? The way it works is explained &lt;a href=&quot;&quot;&gt;elsewhere&lt;/a&gt;, but believe it or not the above code will kick IE5 in to line with the rest of the mainstream browsing world. Here's &lt;a href=&quot;/code/css/jwz/jwz-text.html&quot; title=&quot;jwz, text styled&quot;&gt;how it looks&lt;/a&gt;. Let's move on.&lt;/p&gt;

&lt;h4&gt;Styling the Entry&lt;/h4&gt;

&lt;p&gt;Now that text sizing is out of the way, we can get on with styling the entry itself. First, let's look at the div surrounding each entry. Firstly, it needs to be 600 pixels wide to match the width of the table in the original. The original design has a 2 pixel wide line around the edge of the table, and we can replicate this using a &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; border. Borders in &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; can be applied to the top, left, right and/or bottom of an element in any colour, any thickness and a number of different styles: they are a very powerful tool. In this case we just need a 2 pixel wide green border around the whole div. Here's the &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div.entry {
  width: 600px;
  border: 2px solid #0c0; /* Applied all the way around the div */
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The entry title is a critical part of the design. We have used an h2, but we need to style this with a green background and correctly sized black text. Headers always come with a default margin above and below the header, but since we are using the background colour of the element as part of the design we need to eliminate this by specifically setting the margins around the element to 0. We also need some padding to give the text inside the element some space - trial and error leads us to set this at 5 pixels:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;h2 {
  margin: 0;
  padding: 5px;
  font-size: 1em;
  color: #000;
  background-color: #0c0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The date for each entry appears alongside the title, on the right hand side. As we saw last time, this can be achieved with a float. I'll also set the font size to 0.85em (again found using trial and error) and add some padding to ensure the date appears inline with the heading:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div.entry p.date {
  font-size: 0.85em;
  float: right;
  color: #000;
  background-color: #0c0
  margin: 0;
  padding-top: 5px;
  padding-right: 5px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I've specified the background-color again because it is good practise to always set a background colour at the same time as you set the colour of an element. This helps ensure you never accidentally end up with unreadable text that is the same colour as its background.&lt;/p&gt;

&lt;p&gt;Here's what our redesign &lt;a href=&quot;/code/css/jwz/jwz-header.html&quot;&gt;looks like now&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Tidying up the text&lt;/h4&gt;

&lt;p&gt;There are two glaring problems with what we now have. Firstly, there is no space between the borders and the text. Secondly, the link colours aren't as they should be. We can lift the link colours straight from the attributefs on the body tag in the original site:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;a:link {
  color: #00DDFF;
  text-decoration: none;
}
a:visited {
  color: #FF6633;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We are using &lt;code&gt;a:link&lt;/code&gt; as the selector rather than just &lt;code&gt;a&lt;/code&gt; on its own, because &lt;code&gt;a&lt;/code&gt; will match all &lt;code class=&quot;html&quot;&gt;&amp;lt;a&amp;gt;&lt;/code&gt; elements including those that are just being used as a link target. There aren't any on the page, but it's a good idea to get in to the practise of using &lt;code&gt;a:link&lt;/code&gt; to style links anyway. &lt;code&gt;a:visited&lt;/code&gt; applies styles to visited links. The &lt;code&gt;:something&lt;/code&gt; syntax is called a &lt;dfn&gt;pseudo-selector&lt;/dfn&gt;. It's also worth noting an accessibility point here: it's generally a very bad idea to set links apart from normal text by colour alone, so &lt;code&gt;text-decoration: none&lt;/code&gt; should be discouraged unless some other non-colour based visual indicator is also specified. I'm ignoring that for this example in order to comply with the original design.&lt;/p&gt;

&lt;p&gt;Space between the border and the text can be added in a number of ways: as padding within the entry, as a margin on the paragraphs or as padding on the paragraphs. Since we have set a width on the entry it's a good idea to avoid adding padding to this as this can result in IE5 misbehaving (a box model problem, which could be solved by the box model hack but why hack when you can possibly avoid it?). Instead we will set a margin on the paragraphs:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div.entry p {
  margin: 1em 5px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here we are using another &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; shorthand. Both padding and margin properties can be set with one, two, three or four properties. If only one is provided, it is applied to all four sides. If two are provided (as in this example) the first is applied to top and bottom and the second to left and right. If four are provided, they apply to Top, Right, Bottom, Left respectively (a good mnemonic for this is &lt;strong&gt;TR&lt;/strong&gt;ou&lt;strong&gt;BL&lt;/strong&gt;e, which I picked up from Eric Meyer). Behaviour for three properties is defined but it's quite complicated so I recommend avoiding it entirely. The upshot of all this is that the above rule adds a 1em margin to the top and bottom of each paragraph and 5 pixels to either side. You'd be forgiven for thinking that this means margins would be spaced 2 ems apart, but in fact the margins on elements on top of each other &lt;dfn&gt;collapse&lt;/dfn&gt; to fill the space of just one. I'll talk about this more when I cover the box model in detail.&lt;/p&gt;

&lt;p&gt;The styles for the comments section at the bottom (complete with dark green background) and the music section at the top of the entry should be pretty self explanatory, so I'll provide them here without further analysis:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div.entry p.comments {
  background-color: #040;
  margin: 0;
  padding: 5px;
  text-align: right;
  font-size: 0.85em;
}
p.comments a.count {
  font-weight: bold;
}
div.entry p.music {
  font-size: 0.85em;
  margin-top: 0.5em;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that both paragraphs have a margin explicitly set - this is important as we need to over-ride the margin set on all paragraphs within div.entry earlier on. This is also related to the reason the full &lt;code class=&quot;selector&quot;&gt;div.entry p.comments&lt;/code&gt; selector is used instead of just &lt;code&gt;p.comments&lt;/code&gt; - if you want to know the full reason for this, look up the &lt;a href=&quot;http://www.w3.org/TR/REC-CSS2/cascade.html#specificity&quot;&gt;CSS specificity rules&lt;/a&gt; which are outside the scope of this article.&lt;/p&gt;

&lt;h4&gt;Centering the DIV&lt;/h4&gt;

&lt;p&gt;&lt;a href=&quot;/code/css/jwz/jwz-uncentered.html&quot; title=&quot;jwz in CSS, styled but uncentered&quot;&gt;We're nearly there&lt;/a&gt;! All that remains is to center the div on the page. This is the point where our second IE5/Windows bug rears it's ugly head...&lt;/p&gt;

&lt;p&gt;The standard way of centering a block level element (for example a div or a paragraph) in &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; is to set the left and right margins of the paragraph to &quot;auto&quot;. This can be achieved using the shorthand property explained above: &lt;code&gt;margin: 0 auto;&lt;/code&gt;. Were it not for IE5, our troubles would be over. Unfortunately, IE5 fails to recognise this method.&lt;/p&gt;

&lt;p&gt;As luck would have it, we can now use another IE5 bug to our advantage. The &lt;code&gt;text-align: center&lt;/code&gt; declaration, as you might expect, aligns text in the center of the element. IE5 incorrectly also applies the property to block level elements, which include our troublesome div. So we can set &lt;code&gt;text-align: center&lt;/code&gt; on our body element and all is well...?&lt;/p&gt;

&lt;p&gt;Not quite. Like most text properties (such as the font-size property we were playing with earlier) &lt;code&gt;text-align&lt;/code&gt; is inherited. If we center the text in our body, we end up centering it in all of our other elements as well. Luckily we can use &lt;code&gt;text-align: left&lt;/code&gt; on the other elements in our document to prevent this from happening. Combine these three &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; tricks and you get the following method for centering elements in an IE5 friendly way:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;body {
  ...
  text-align: center;
}
div.entry {
  ...
  margin: 0 auto;
}
body div, body p, body h2 {
  text-align: left;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which brings us to our final result: &lt;a href=&quot;http://simon.incutio.com/code/css/jwz/jwz.html&quot;&gt;JWZ's blog entries in pure CSS&lt;/a&gt;. It took quite a bit of work, but I think the results speak for themselves.&lt;/p&gt;

&lt;h4&gt;What you should have learned&lt;/h4&gt;

&lt;p&gt;While most designs can be achieved in &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;, some are harder than others. This is not the fault of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;; it is more a problem with faulty browser implementations of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;. When people call IE5/Windows the &quot;new Netscape 4&quot;, they are doing so with good reason! However, IE5's deficiencies are well understood with the &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; community and workarounds exist which, while initially tricky, for the most part work very well. With a bit of insider knowledge the beast can be tamed.&lt;/p&gt;

&lt;p&gt;In this tutorial I've tried to roll up my sleeves and get stuck in to the dirtier side of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; development. I've demonstrated some hacks, and I've shown how there can be more to practical &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; than meets the eye. It may seem like an awful lot of work, but in fact the initial jwz remake took me just over half an hour thanks to my previous experience with IE5 bugs.&lt;/p&gt;

&lt;p&gt;For the next installment, I will be stepping back from hacks and unpleasantries and looking at &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; being used in a much simpler light: to visually enhance semantically structured page elements. I also have another case study planned which will make much lighter reading than this one. As always, comments are welcome.&lt;/p&gt;

&lt;p&gt;And finally, apologies to jwz for borrowing without asking. I hope I haven't caused offence.&lt;/p&gt;</description>
  <link>http://simon.incutio.com/archive/2003/05/20/defeatingIE5</link>
  <dc:subject>CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-05-20T23:58:01-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>
<item rdf:about="http://simon.incutio.com/archive/2003/05/19/scriptingWithCSS">
  <title>Scripting.com, with added CSS</title>
  <description>&lt;p&gt;One of the aims of this course is to show how relatively simple &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; can be used to make dramatic improvements to existing sites. Today, I'll show how &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; can be used to reduce the amount of code needed for a small part of the design of &lt;a href=&quot;http://www.scripting.com/&quot;&gt;Scripting.com&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Scripting.com presents the main blog entries as a series of paragraphs under a single header for each day. Here is a screenshot from today's edition of the site:&lt;/p&gt;

&lt;p class=&quot;img&quot;&gt;&lt;img src=&quot;/code/css/scripting/original.gif&quot; alt=&quot;Scripting.com entries, in a table based layout&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; behind the above screenshot is as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;table width=&quot;400&quot; cellspacing=&quot;0&quot; cellpadding=&quot;3&quot; border=&quot;0&quot;&amp;gt;
	&amp;lt;tr bgcolor=&quot;#000000&quot;&amp;gt;
		&amp;lt;td colspan=&quot;2&quot;&amp;gt;&amp;lt;font color=&quot;#F5F5F5&quot;&amp;gt;&amp;nbsp;&amp;lt;b&amp;gt;Monday, May 19, 
2003&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;
		&amp;lt;td valign=&quot;middle&quot;&amp;gt;&amp;lt;font color=&quot;#F5F5F5&quot;&amp;gt;&amp;nbsp;
&amp;lt;b&amp;gt;&amp;lt;a href=&quot;http://scriptingnews.userland.com/2003/05/19&quot; 
title=&quot;Permanent link to Scripting News archive for Monday, May 19, 2003.&quot;&amp;gt;
&amp;lt;img src=&quot;http://www.scripting.com/images/home/dailyLinkIcon.gif&quot; 
height=&quot;15&quot; width=&quot;12&quot; border=&quot;0&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/b&amp;gt;&amp;lt;/font&amp;gt;&amp;lt;/td&amp;gt;
		&amp;lt;/tr&amp;gt;
	&amp;lt;tr bgcolor=&quot;white&quot;&amp;gt;
		&amp;lt;td width=&quot;5&quot;&amp;gt;&amp;nbsp;&amp;lt;/td&amp;gt;
		&amp;lt;td valign=&quot;top&quot;&amp;gt;
			&amp;lt;br&amp;gt;
			&amp;lt;a name=&quot;When:1:11:34PM&quot;&amp;gt;
&amp;lt;a href=&quot;http://icann.blog.us/2003/05/19.html#a1356&quot;&amp;gt;Bret Fausett&amp;lt;/a&amp;gt;: 
&quot;It seems that an article making the rounds on Googlenews -- '.org Registry 
Vanishes Into Thin Air'  -- has no merit whatsoever. &amp;nbsp;
&amp;lt;a href=&quot;http://scriptingnews.userland.com/2003/05/19#When:1:11:34PM&quot; 
title=&quot;Permanent link to this item in archive.&quot;&amp;gt;
&amp;lt;img src=&quot;http://www.scripting.com/images/2001/09/20/sharpPermaLink3.gif&quot; 
height=&quot;9&quot; width=&quot;6&quot; border=&quot;0&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;

&amp;lt;a name=&quot;When:7:06:28AM&quot;&amp;gt;Guardian: 
&amp;lt;a href=&quot;http://www.guardian.co.uk/online/comment/story/0,12449,959151,00.html&quot;&amp;gt;
The blog clog myth&amp;lt;/a&amp;gt;. &amp;nbsp;
&amp;lt;a href=&quot;http://scriptingnews.userland.com/2003/05/19#When:7:06:28AM&quot; 
title=&quot;Permanent link to this item in archive.&quot;&amp;gt;&amp;lt;img 
src=&quot;http://www.scripting.com/images/2001/09/20/sharpPermaLink3.gif&quot; 
height=&quot;9&quot; width=&quot;6&quot; border=&quot;0&quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I've added some extra line breaks to fit all of the code in the space available, but other than that it's unmodified.&lt;/p&gt;

&lt;p&gt;First, let's reduce the above to the equivalent structural HTML, removing all of the presentational tags and adding in a few that might be useful. We're also going to remove the images - they'll still be there in the final version, but by using background images defined in the &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; we can save quite a lot of code.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;div class=&quot;entry&quot;&amp;gt;
&amp;lt;h2&amp;gt;&amp;lt;a href=&quot;http://scriptingnews.userland.com/2003/05/19&quot; 
title=&quot;Permanent link to Scripting News archive for Monday, May 19, 2003.&quot;
class=&quot;permalink&quot;&amp;gt;&amp;lt;span&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;Monday, May 19, 2003&amp;lt;/h2&amp;gt;

&amp;lt;p&amp;gt;&amp;lt;a name=&quot;When:1:11:34PM&quot;&amp;gt;&amp;lt;/a&amp;gt;
&amp;lt;a href=&quot;http://icann.blog.us/2003/05/19.html#a1356&quot;&amp;gt;Bret Fausett&amp;lt;/a&amp;gt;: 
&quot;It seems that an article making the rounds on Googlenews -- '.org Registry 
Vanishes Into Thin Air' -- has no merit whatsoever. 
&amp;lt;a href=&quot;http://scriptingnews.userland.com/2003/05/19#When:1:11:34PM&quot; 
title=&quot;Permanent link to this item in archive.&quot; class=&quot;permalink&quot;&amp;gt;&amp;lt;span&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;&amp;lt;a name=&quot;When:7:06:28AM&quot;&amp;gt;&amp;lt;/a&amp;gt;Guardian: 
&amp;lt;a href=&quot;http://www.guardian.co.uk/online/comment/story/0,12449,959151,00.html&quot;&amp;gt;
The blog clog myth&amp;lt;/a&amp;gt;. 
&amp;lt;a href=&quot;http://scriptingnews.userland.com/2003/05/19#When:7:06:28AM&quot; 
title=&quot;Permanent link to this item in archive.&quot; class=&quot;permalink&quot;&amp;gt;&amp;lt;span&amp;gt;#&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;

&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;A few notes about the above. First, I've wrapped the whole entry in a div with the class &quot;entry&quot;. This means I can use descendant selectors to style the other elements in the block qithout needing to add additional classes. The only classes I've added are the permalink classes on the various permalinks - these will be used in a moment. Note also that the '#' signs in the permalinks have a span tag around them. The reason for this will become apparent in a moment. The table used for the header has been replaced with a structural h2 tag. Header tags should be applied in order, with the most important header on the page using h1 and the other headers being used for sub headers, sub-sub headers and so on. I'm assuming that h1 would be used for the site title (or logo) so I'm using h2 in this example.&lt;/p&gt;

&lt;p&gt;The unstyled HTML can be seen &lt;a href=&quot;/code/css/scripting/stripped.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Now let's style it with some &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;. First up, Scripting.com's main layout table is 400 pixels wide. We can emulate that by applying a width to our &amp;lt;div&amp;gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div.entry {
  width: 400px;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now let's concentrate on the header. The date header on Scripting.com has a black background with white text. The text is bold, and is displayed at the same size as the body text of the rest of the site. In &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;, relative sizes can be specified using the em unit. 1em means 1 times the current text size, so we'll set the font-size to 1em. Finally, the header is padded with about 3 pixels on every side. Here's the &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;h2 {
  background-color: black;
  color: white;
  font-size: 1em;
  font-weight: bold;
  padding: 3px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;See the result &lt;a href=&quot;/code/css/scripting/header1.html&quot; title=&quot;First styles applied to the header&quot;&gt;here&lt;/a&gt;. So far, so good - but what about the funky permalink? It's an image, and it appears over on the right. Normally this would be a sign that we need a table, but we can achieve the same effect in &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; using the float property. Floats are actually one of the hardest properties to fully understand, but if you've ever used the align attribute on an image you should have a good idea of what they do. We will use &lt;code class=&quot;css&quot;&gt;float: right&lt;/code&gt; on the permalink to cause it to shfit as far right as possible, appearing next to the main header text.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;
h2 a.permalink {
  float: right;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;But what about the image? Here's where things get tricky. We're going to use a technique called the &lt;a href=&quot;http://www.stopdesign.com/log/default.asp?date=20030314&quot; title=&quot;More on Background-Image, I&quot;&gt;Fahrner Image Replacement&lt;/a&gt;. This is what the extra spans are for - we can apply a background image to the a element, then make the contents of the span invisible using &lt;code class=&quot;css&quot;&gt;display: none&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;h2 a.permalink {
  float: right;
  width: 12px;
  height: 15px;
  background-image: url(&quot;dailyLinkIcon.gif&quot;);
}
h2 a.permalink span {
  display: none;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And &lt;a href=&quot;/code/css/scripting/header2.html&quot; title=&quot;The completed header&quot;&gt;here's the result&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That's the header finished - now for the paragraphs. The first thing to notice is that they are indented approximately 15 pixels on the left hand side. This can be easily emulated in &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; using either a margin or padding - I'll use padding, but margin would work just fine as well.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div.entry p {
  padding-left: 15px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We're nearly finished - all that's left to do now is the permalinks at the end of each paragraph. We will use  &lt;acronym title=&quot;Fahrner Image Replacement&quot;&gt;FIR&lt;/acronym&gt; again, but this time the background image we are using is far smaller than the # sign it is replacing so we can take a slightly different approach:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;div.entry p a.permalink {
  background: #fff url(&quot;sharpPermaLink.gif&quot;) no-repeat center center;
  text-decoration: none;
}
div.entry p a.permalink span {
  visibility: hidden;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This time the permalink is made invisible using the visiblility property rather than being removed entirely - that way we don't have to worry about adding a width or height to the link. The background image is placed using a shorthand property which allows all of the background properties to be specified at once - it should be relatively clear what the property does.&lt;/p&gt;

&lt;p&gt;The end result &lt;a href=&quot;/code/css/scripting/finished.html&quot; title=&quot;Scripting.com entries with CSS&quot;&gt;can be seen here&lt;/a&gt; - viewed in a standards compliant browser (I tried it in Firebird, IE 5 and Opera 7) I think you'll agree it's an almost exact replica of the original, but with a great deal less markup. Times that saving by several dozen entries on a page and it really starts to add up.&lt;/p&gt;

&lt;p&gt;Final note: this entry comes with apologies to Dave Winer of scripting.com, who has not been consulted prior to the publication of the article.&lt;/p&gt; </description>
  <link>http://simon.incutio.com/archive/2003/05/19/scriptingWithCSS</link>
  <dc:subject>CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-05-19T23:58:23-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>
<item rdf:about="http://simon.incutio.com/archive/2003/05/18/anatomyOfAStylesheet">
  <title>The anatomy of a stylesheet</title>
  <description>&lt;p&gt;To start my series of tutorials, I'm going to go over some of the basics of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;. This is the boring bit: if you already know the difference between rules, properties and selectors you may want to skip this entry.&lt;/p&gt;

&lt;p&gt;The basic building block of a stylesheet is the &lt;dfn&gt;rule&lt;/dfn&gt;. A rule is a statement applying one or more properties to one or more elements. The declaration of a rule is split in to two parts; the &lt;dfn&gt;selector&lt;/dfn&gt; and the &lt;dfn&gt;declaration block&lt;/dfn&gt;, which itself consists of &lt;dfn&gt;declarations&lt;/dfn&gt;. Each declaration consists of a &lt;dfn&gt;property&lt;/dfn&gt; and a &lt;dfn&gt;value&lt;/dfn&gt;. Confused by the terminology yet? Don't worry, that's about as complicated as it gets, and I'll be providing a summary of definitions later on.&lt;/p&gt;

&lt;p&gt;Here is an example of a rule:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;h1 {
  color: navy;
  border-bottom: 1px solid black;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In the above, h1 is the selector; it specifies the parts of the &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; document that the rule should be applied to. In this case, it means &quot;all &amp;lt;h1&amp;gt; elements&quot;. The curly braces mark the declaration block, with the two declarations separated by semi-colons. I've placed the declarations on different lines but this is purely a coding style thing: &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; ignores whitespace as a general rule.&lt;/p&gt;

&lt;p&gt;The meanings of the two declarations should be relatively self evident: &lt;code class=&quot;css&quot;&gt;color: navy&lt;/code&gt; (note the American spelling of &quot;color&quot;) sets the colour of the text to navy blue, while &lt;code class=&quot;css&quot;&gt;border-bottom: 1px solid black;&lt;/code&gt; adds a 1 pixel wide solid black border to the bottom of the element. In fact, this is an example of a &lt;dfn&gt;shorthand property&lt;/dfn&gt; which allows several properties to be set at once.&lt;/p&gt;

&lt;p&gt;There are over 100 properties defined by the CSS2 specification, but they are generally quite straight forward and can be picked up as you go along. Selectors are also straight forward but their importance is often underestimated: in my opinion, understanding them thoroughly is critical to learning to use &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; effectively.&lt;/p&gt;

&lt;h4&gt;Selectors&lt;/h4&gt;

&lt;p&gt;The selector part of a rule specifies which parts of the associated document the rule should be applied to. Selectors are always positioned at the start of a rule before the open curly brace. More than one selector can be specified for a single rule, in which case the selectors must be separated by commas:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;/* Make all &amp;lt;h1&amp;gt; and &amp;lt;h2&amp;gt; elements navy blue */
h1, h2 {
  color: navy; 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The most basic form of selector, demonstrated above, is the element or type selector. It is written as the tag name of an HTML element and matches all elements of that type.&lt;/p&gt;

&lt;p&gt;The next most common selectors are those based on classes and IDs. A class is any string of numbers and letters, starting with a letter - for example, &quot;blogentry&quot;, &quot;nav&quot;, &quot;codeSample&quot;, &quot;row2&quot;. Classes can be assigned to any element within an &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; document using the class attribute. Multiple classes can be assigned to an element by placing a list of classes in the class attribute separated by spaces. For example:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;div class=&quot;blogentry first&quot;&amp;gt;...&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The above is the &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; for a div that has both &quot;blogentry&quot; and &quot;first&quot; as classes.&lt;/p&gt;

&lt;p&gt;Classes can then be used as part of a selector, by appending a full-stop on to the front of the class name:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;/* Colour anything with class=&quot;blogentry&quot; navy blue */
.blogentry {
  color: navy;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Class selectors can include an element name as well, to limit the application of the rules to specific elements with the specified class:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;/* Colour only divs with class=&quot;blogentry&quot; navy blue */
div.blogentry {
  color: navy;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The above piece of &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; will change the colour of &lt;code class=&quot;html&quot;&gt;&amp;lt;div class=&quot;blogentry&quot;&amp;gt;&lt;/code&gt;, but will not affect &lt;code class=&quot;html&quot;&gt;&amp;lt;h3 class=&quot;blogentry&quot;&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;ID selectors affect elements with a specific id attribute. IDs are like classes in that they can be applied to any element, but unlike classes any specific ID can only be used &lt;strong&gt;once&lt;/strong&gt; within any single document. Classes can be used as many times as you like. As a result, IDs should be used on page items that occur only once, such as a company logo that appears in the top left hand corner of a page. ID selectors consist of the ID with a # sign preprended on to it:&lt;/p&gt;


&lt;pre&gt;&lt;code class=&quot;css&quot;&gt;/* Position the element with id=&quot;logo&quot; at the top left of the page */
#logo {
  position: absolute;
  top: 0px;
  left: 0px;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The above example would position any element with id=&quot;logo&quot; at the top left of the page, using absolute positioning (which I will cover in detail later in the course).&lt;/p&gt;

&lt;p&gt;As with class selectors, you can include the element name before the hash sign. This may seem unnecessary since only one item on any page can have a specific ID, but I find doing so helps make the resulting stylesheet more readable as it reminds me what type of element the ID is attached to.&lt;/p&gt;

&lt;p&gt;With the basic selectors out of the way, the next most useful selector is the &lt;dfn&gt;descendant selector&lt;/dfn&gt;. This consists of two or more selectors separated by spaces, and has the effect of matching things that match each of the selectors, going from first to last. For example, &lt;code class=&quot;css&quot;&gt;div#main a&lt;/code&gt; matches all links that occur inside &lt;code class=&quot;html&quot;&gt;&amp;lt;div id=&quot;main&quot;&amp;gt;&lt;/code&gt;, while &lt;code class=&quot;css&quot;&gt;div#nav ul.plain li&lt;/code&gt; would match all &lt;code class=&quot;html&quot;&gt;&amp;lt;li&amp;gt;&lt;/code&gt;s occuring inside a &lt;code class=&quot;html&quot;&gt;&amp;lt;ul class=&quot;plain&quot;&amp;gt;&lt;/code&gt; that itself occurs inside &lt;code class=&quot;html&quot;&gt;&amp;lt;div id=&quot;nav&quot;&amp;gt;&lt;/code&gt;. Descendant selectors are extremely powerful, and can often be used in place of a large number of class attributes. In general, if you find yourself using a class attribute on every one of a whole bunch of similar elements you may be able to replace them all with a class attribute on a containing element accompanied by a descendant selector in the stylesheet.&lt;/p&gt;

&lt;h4&gt;Attaching a stylesheet&lt;/h4&gt;

&lt;p&gt;Now that you know what goes in a stylesheet, you need to know how to attach rules to an &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; document. There are two options: &lt;dfn&gt;internal stylesheets&lt;/dfn&gt;, where the &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; is included at the top of the page, and &lt;dfn&gt;external stylesheets&lt;/dfn&gt;, where the stylesheet is a separate file. External stylesheets are generally a better bet as they allow a single stylesheet to be shared across multiple pages (dramatically improving download times as the stylesheet can be downloaded once and then cached by the browser), but I will describe both methods here. Here is the code for an internal stylesheet:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;...
&amp;lt;head&amp;gt;
&amp;lt;style type=&quot;text/css&quot;&amp;gt;
h1 {
  color: blue;
}
...
&amp;lt;/style&amp;gt;
...
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; rules are placed within a &lt;code class=&quot;html&quot;&gt;&amp;lt;style&amp;gt;&lt;/code&gt; element within the head section of the document. The &lt;code class=&quot;html&quot;&gt;type=&quot;text/css&quot;&lt;/code&gt; attribute specifies the stylesheet language being used (on the offchance that another stylesheet language is created some time in the future).&lt;/p&gt;

&lt;p&gt;For an external stylesheet, the &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; rules are saved in a file with a .css extension (the file extension is not ompulsory but the file should be served with a &lt;code&gt;text/css&lt;/code&gt; content type header, and most web servers are configured to serve .css files using that content type). The &lt;acronym title=&quot;HyperText Markup Language&quot;&gt;HTML&lt;/acronym&gt; to link in an external stylesheet, again placed in the head section, is as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;html&quot;&gt;&amp;lt;link rel=&quot;stylesheet&quot; href=&quot;path/to/stylesheet.css&quot; type=&quot;text/css&quot;&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's all the basic &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt; I plan to cover; my next article will start on the core material of the course, which will be a set of case studies showing how existing sites using legacy markup can be dramatically improved through the addition of a little careful &lt;acronym title=&quot;Cascading Style Sheets&quot;&gt;CSS&lt;/acronym&gt;.&lt;/p&gt;</description>
  <link>http://simon.incutio.com/archive/2003/05/18/anatomyOfAStylesheet</link>
  <dc:subject>CSS ain't Rocket Science</dc:subject>
  <dc:date>2003-05-18T23:56:15-00:00</dc:date>
  <dc:creator>Simon Willison</dc:creator>
</item>

</rdf:RDF>