<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom"><title>Simon Willison's Weblog: jwz</title><link href="http://simonwillison.net/" rel="alternate"/><link href="http://simonwillison.net/tags/jwz.atom" rel="self"/><id>http://simonwillison.net/</id><updated>2022-11-28T06:22:25+00:00</updated><author><name>Simon Willison</name></author><entry><title>Quoting JWZ</title><link href="https://simonwillison.net/2022/Nov/28/jwz/#atom-tag" rel="alternate"/><published>2022-11-28T06:22:25+00:00</published><updated>2022-11-28T06:22:25+00:00</updated><id>https://simonwillison.net/2022/Nov/28/jwz/#atom-tag</id><summary type="html">
    &lt;blockquote cite="https://www.jwz.org/blog/2022/11/psa-do-not-use-services-that-hate-the-internet/"&gt;&lt;p&gt;If posts in a social media app do not have URLs that can be linked to and viewed in an unauthenticated browser, or if there is no way to make a new post from a browser, then that program is not a part of the World Wide Web in any meaningful way.&lt;/p&gt;
&lt;p&gt;Consign that app to oblivion.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p class="cite"&gt;&amp;mdash; &lt;a href="https://www.jwz.org/blog/2022/11/psa-do-not-use-services-that-hate-the-internet/"&gt;JWZ&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/jwz"&gt;jwz&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/social-media"&gt;social-media&lt;/a&gt;&lt;/p&gt;



</summary><category term="jwz"/><category term="social-media"/></entry><entry><title>Happy Run Some Old Web Browsers Day!</title><link href="https://simonwillison.net/2008/Mar/31/jwz/#atom-tag" rel="alternate"/><published>2008-03-31T17:54:56+00:00</published><updated>2008-03-31T17:54:56+00:00</updated><id>https://simonwillison.net/2008/Mar/31/jwz/#atom-tag</id><summary type="html">
    
&lt;p&gt;&lt;strong&gt;&lt;a href="http://jwz.livejournal.com/856745.html"&gt;Happy Run Some Old Web Browsers Day!&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
jwz has recreated home.mcom.com, the original home of the Mosaic Communications Corporation, using a snapshot from 21st October 1994 and a domain borrowed from current owner AOL. Also includes instructions on running 1994 Mosaic Netscape binaries under a modern Linux distro.


    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/aol"&gt;aol&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/browsers"&gt;browsers&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/history"&gt;history&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jwz"&gt;jwz&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/linux"&gt;linux&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/mosaic"&gt;mosaic&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/netscape"&gt;netscape&lt;/a&gt;&lt;/p&gt;



</summary><category term="aol"/><category term="browsers"/><category term="history"/><category term="jwz"/><category term="linux"/><category term="mosaic"/><category term="netscape"/></entry><entry><title>Quoting John Panzer</title><link href="https://simonwillison.net/2007/Jul/19/every/#atom-tag" rel="alternate"/><published>2007-07-19T08:26:42+00:00</published><updated>2007-07-19T08:26:42+00:00</updated><id>https://simonwillison.net/2007/Jul/19/every/#atom-tag</id><summary type="html">
    &lt;blockquote cite="http://journals.aol.com/panzerjohn/abstractioneer/entries/2007/07/18/every-mashup-attempts-to-expand.../1499"&gt;&lt;p&gt;Every mashup attempts to expand until it can do social networking.  Those that can't are replaced by those that can.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p class="cite"&gt;&amp;mdash; &lt;a href="http://journals.aol.com/panzerjohn/abstractioneer/entries/2007/07/18/every-mashup-attempts-to-expand.../1499"&gt;John Panzer&lt;/a&gt;&lt;/p&gt;

    &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/john-panzer"&gt;john-panzer&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jwz"&gt;jwz&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/mashups"&gt;mashups&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/social-networking"&gt;social-networking&lt;/a&gt;&lt;/p&gt;



</summary><category term="john-panzer"/><category term="jwz"/><category term="mashups"/><category term="social-networking"/></entry><entry><title>Defeating IE5 CSS bugs with the help of jwz</title><link href="https://simonwillison.net/2003/May/20/defeatingIE5/#atom-tag" rel="alternate"/><published>2003-05-20T23:58:01+00:00</published><updated>2003-05-20T23:58:01+00:00</updated><id>https://simonwillison.net/2003/May/20/defeatingIE5/#atom-tag</id><summary type="html">
    &lt;p&gt;Today's &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; case study will be &lt;a href="http://www.livejournal.com/~jwz/"&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="http://www.livejournal.com/~jwz/193866.html"&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 "bugs in IE5 for Windows", 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="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; will hopefully turn a few heads.&lt;/p&gt;

&lt;p&gt;Here's the "before" screenshot:&lt;/p&gt;

&lt;p class="img"&gt;&lt;img alt="Life isn&amp;apos;t fun 24 hours a day..." height="333" longdesc="http://www.livejournal.com/~jwz/203141.html" src="https://static.simonwillison.net/static/2003/jwz/jwz.gif" width="615" /&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="html"&gt;
&amp;lt;table summary="" border="0" cellpadding="2" class="entrybox" width="600" 
cellspacing="0"&amp;gt;
&amp;lt;tr align="left"&amp;gt;
&amp;lt;td align="center" bgcolor="#00CC00"&amp;gt;
&amp;lt;table summary="" border="0" cellpadding="5" width="100%" cellspacing="0"&amp;gt;

&amp;lt;tr align="left"&amp;gt;
&amp;lt;td class="caption"&amp;gt;Life isn't fun 24 hours a day, so shopping should be.&amp;lt;/td&amp;gt;
&amp;lt;td class="index" align="right"&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="left"&amp;gt;
&amp;lt;td bgcolor="#000000" colspan="2"&amp;gt;

&amp;lt;table summary="" border="0" cellpadding="0" cellspacing="0"&amp;gt;
&amp;lt;tr&amp;gt;
&amp;lt;td class="meta"&amp;gt;[&amp;lt;/td&amp;gt;

&amp;lt;td class="meta" align="right"&amp;gt;&amp;lt;b&amp;gt;music&amp;lt;/b&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;td class="meta" align="center"&amp;gt;|&amp;lt;/td&amp;gt;
&amp;lt;td class="meta"&amp;gt;Luscious Jackson -- Bam Bam&amp;lt;/td&amp;gt;
&amp;lt;td class="meta"&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="
http://www.nytimes.com/2003/05/18/magazine/18TOKYO.html?8hpib=&amp;amp;amp;pagewanted=all"&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="comments" width="100%" align="right" bgcolor="#004400" colspan="2"&amp;gt;
&amp;lt;a href="http://www.livejournal.com/~jwz/203141.html"&amp;gt;&amp;lt;b&amp;gt;2 comments&amp;lt;/b&amp;gt;&amp;lt;/a&amp;gt;|
&amp;lt;a href="http://www.livejournal.com/~jwz/203141.html?mode=reply"&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="html"&gt;&amp;lt;div class="entry"&amp;gt;
&amp;lt;p class="date"&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="music"&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="
http://www.nytimes.com/2003/05/18/magazine/18TOKYO.html?8hpib=&amp;amp;amp;pagewanted=all"&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="comments"&amp;gt;
&amp;lt;a href="http://www.livejournal.com/%7Ejwz/203141.html" class="count"&amp;gt;2 comments&amp;lt;/a&amp;gt;
|&amp;lt;a href="http://www.livejournal.com/%7Ejwz/203141.html?mode=reply"&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="https://static.simonwillison.net/static/2003/jwz/jwz-unstyled.html" title="jwz restructured and unstyled"&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="css"&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="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; allows you to use three instead of six and will "double" 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="Cascading Style Sheets"&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="Cascading Style Sheets"&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="http://www.thenoodleincident.com/tutorials/box_lesson/font/"&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="css"&gt;small&lt;/code&gt; and &lt;code class="css"&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="Cascading Style Sheets"&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="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; community. Some people see them as an anathema to everything that &lt;acronym title="Cascading Style Sheets"&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="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;, I'll leave discussions of the validity of hacks to the &lt;a href="http://css-discuss.incutio.com/?page=ToHackOrNotToHack" title="To hack or not to hack"&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="http://www.tantek.com/CSS/Examples/boxmodelhack.html"&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="Cascading Style Sheets"&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="css"&gt;body {
  background-color: #000;
  color: #0f0;
  font-family: verdana, sans-serif;
  font-size: x-small;
  voice-family: "\"}\"";
  voice-family: inherit;
  font-size: small;
}
html&amp;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=""&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="https://static.simonwillison.net/static/2003/jwz/jwz-text.html" title="jwz, text styled"&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="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; border. Borders in &lt;acronym title="Cascading Style Sheets"&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="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code class="css"&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="css"&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="css"&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="https://static.simonwillison.net/static/2003/jwz/jwz-header.html"&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="css"&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="html"&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="css"&gt;div.entry p {
  margin: 1em 5px;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Here we are using another &lt;acronym title="Cascading Style Sheets"&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="css"&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="selector"&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="http://www.w3.org/TR/REC-CSS2/cascade.html#specificity"&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="https://static.simonwillison.net/static/2003/jwz/jwz-uncentered.html" title="jwz in CSS, styled but uncentered"&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="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; is to set the left and right margins of the paragraph to "auto". 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="Cascading Style Sheets"&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="css"&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="https://static.simonwillison.net/static/2003/jwz/jwz.html"&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="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;, some are harder than others. This is not the fault of &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;; it is more a problem with faulty browser implementations of &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;. When people call IE5/Windows the "new Netscape 4", they are doing so with good reason! However, IE5's deficiencies are well understood with the &lt;acronym title="Cascading Style Sheets"&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="Cascading Style Sheets"&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="Cascading Style Sheets"&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="Cascading Style Sheets"&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;
    
        &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/css"&gt;css&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/cssaintrocketscience"&gt;cssaintrocketscience&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jwz"&gt;jwz&lt;/a&gt;&lt;/p&gt;
    

</summary><category term="css"/><category term="cssaintrocketscience"/><category term="jwz"/></entry><entry><title>Defending Structural Markup</title><link href="https://simonwillison.net/2003/May/4/structuralMarkup/#atom-tag" rel="alternate"/><published>2003-05-04T14:20:02+00:00</published><updated>2003-05-04T14:20:02+00:00</updated><id>https://simonwillison.net/2003/May/4/structuralMarkup/#atom-tag</id><summary type="html">
    &lt;p&gt;I've been somewhat taken by surprise by the latest round of anti-&lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; rants (initiated by &lt;a href="http://www.livejournal.com/users/jwz/193866.html" title="jwz: CSS is BS"&gt;JWZ&lt;/a&gt;, followups &lt;a href="http://www.technorati.com/cosmos/links.html?url=http%3A%2F%2Fwww.livejournal.com%2Fusers%2Fjwz%2F193866.html" title="technorati link cosmos for JWZ&amp;apos;s rant"&gt;all over the place&lt;/a&gt;), mainly because I've been using &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; for long enough now that I'd started to forget about the legions of web developers out there who haven't yet realised what they're missing. Instead of getting stuck in to dissecting other people's complaints I'm just going to lay down a few of my own core beliefs.&lt;/p&gt;

&lt;ol&gt;
 &lt;li&gt;&lt;strong&gt;If you work with the web professionally and you have not yet started using &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;, you are doing both yourself, your clients and your profession a disservice.&lt;/strong&gt;&lt;/li&gt;
 &lt;li&gt;&lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; may not be a magic bullet, but it offers far more effective ways of creating attractive web pages than &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt; alone. "Effective" in this case means maintainable, efficient and accessible.&lt;/li&gt;
 &lt;li&gt;&lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; is not rocket science! While browser compatibility issues can certainly cause teething problems, they can be defeated with a little perseverance. Basic &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; (of the kind that can replace several layers of nested tables and spacer gifs) can be picked up in very little time with a huge pay back in increased productivity.&lt;/li&gt;
&lt;li&gt;You don't have to ditch layout tables and stop using about presentational markup to begin to enjoy the benefits of structural markup and &lt;acronym title="Cascadin gStyle Sheets"&gt;CSS&lt;/acronym&gt;! (&lt;em&gt;Added 30 minutes after initial publication&lt;/em&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And now some clarification. The core issue I am interested in isn't &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; vs Tables, it's structural vs presentational markup. To clarify those terms, presentational markup is when you use &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt; markup tags purely to control the "look" of your site in desktop browsers, while structural markup is when you use tags to provide a logical structure to a document and keep visual display information separate, generally through use of a stylesheet. The two are not mutually exclusive; for practical reasons, it is often necessary to add markup to a document for purely presentational reasons. The trick is to minimise this as much as possible.&lt;/p&gt;

&lt;p&gt;Why is separating structure from presentation a good idea? From a theoretical point of view, the answer should be obvious: separating the two adds a powerful additional layer of abstraction which allows either to be modified without needing to make changes to the other. The practical benefits come in the form of increased accessibility, better maintainability  and greatly reduced amounts of code (compare the size of a presentational &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt; page to that of one that uses structural markup and &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;). Being able to change the look of a whole site by modifying a single &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; file is Finally, the ability to re-use content is greatly increased as the clean structure makes it far easier for content to be remoulded for other distribution mediums.&lt;/p&gt;

&lt;p&gt;It is true that there are some things (in particular relating to layout) that cannot yet be reliably achieved using &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; rather than presentational tables, almost entirely due to bugs in modern browser implementations of &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;. It is also true that there are a lot of layout effects that cannot be achieved using purely presentational markup. All web designers should be aware that they are working within the limitations of their medium - if you want pixel perfect control of how something appears then go and play with Flash (and throw universal access to content to the wind). Alternatively, the "transitional" approach where presentational markup is used only when there is no other alternative) is a perfectly valid way approach to modern web design.&lt;/p&gt;

&lt;p&gt;Enough ranting: I'm going to put my money where my mouth is. Over the next few weeks I will give this blog over to a complete course in structural &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt; and &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt;, aimed at web developers who know their way around &lt;acronym title="HyperText Markup Language"&gt;HTML&lt;/acronym&gt; but haven't yet come to terms with &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; - kind of like &lt;a href="http://diveintoaccessibility.org/"&gt;Dive Into Accessibility&lt;/a&gt; with a different focus. I haven't planned this, so I have no idea how long it will take or exactly what it will cover. I'm hoping it will lead to some lively discussions and help drag a few more web developers out of the 90s.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Having re-read the above it doesn't quite say what I wanted it to. My key point was going to be that CSS may not be perfect, and it may not yet be a complete replacement for presentational markup, but it's an ultra-powerful tool that is ready to be used &lt;em&gt;now&lt;/em&gt; and should have a place in any web professional's toolbox. The promise of a tutorial series still stands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 2:&lt;/strong&gt; I've &lt;a href="/2003/May/06/cssTutorialDelayed/" title="Delay to the start of my CSS tutorial series"&gt;delayed&lt;/a&gt; the planned start of my &lt;acronym title="Cascading Style Sheets"&gt;CSS&lt;/acronym&gt; tutorial series by a week or two.&lt;/p&gt;
    
        &lt;p&gt;Tags: &lt;a href="https://simonwillison.net/tags/css"&gt;css&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/cssaintrocketscience"&gt;cssaintrocketscience&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/html"&gt;html&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/jwz"&gt;jwz&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/semantic"&gt;semantic&lt;/a&gt;, &lt;a href="https://simonwillison.net/tags/structural"&gt;structural&lt;/a&gt;&lt;/p&gt;
    

</summary><category term="css"/><category term="cssaintrocketscience"/><category term="html"/><category term="jwz"/><category term="semantic"/><category term="structural"/></entry></feed>