I feel like shit, and have spent a proportion of the afternoon in bed so really shouldn’t be involving myself in this right now, but I can’t help it.
Hacker News and Reddit have been bickering today on CSS vs. tables. I have, for the most part, kept out of it. Despite being an advocate of CSS, I don’t need to justify that to anyone. I am more efficient, and can produce better websites in CSS than I ever could with tables. I positively cringe whenever I have to do an e-mail newsletter/”e-shot” at work, because they generally only work in tables. Anyway, I’ve stepped in because now both sides are spreading misinformation.
Firstly, pro-tables Ron Garret used a 3-column layout taken from a 3rd party website that was “back to front” to argue that:
The reason that the order matters is that this layout, like all multi-column CSS layouts, is achieved with floats, and the way that floats get rendered depends on the order in which they appear. So we have not managed to separate content from presentation.
Then, pro-CSS Joel Sutherland agrees with him:
A central point of Ron Garret’s “Why CSS should not be used for layout” is that CSS is flawed because you cannot rearrange the elements of an html document and maintain a consistent presentation. This is true, but it misses the point
They’re both wrong. You can order your content how your like. You are restricted only by your knowledge of CSS and not its ability as a styling language to render your documents. It took me about 30 minutes to knock up a demonstration, which you can see for yourself: columns in order and columns out of order. Both are visually identical in appearance, both use CSS to control the positioning of the columns, but one is in “correct” logical order in the document (left, center, right) and the other out of order (center, left, right). (Only tested in Firefox3 on Linux.)
I have nothing against programmers who choose to use tables, nor do I care if the world takes on the CSS revolution, but these are the kind of anal perfection-obsessed hackers and programmers that freely comment on the mistakes of Jeff Atwood and Robert Scoble at every opportunity, and yet are happy to support other’s mistakes as fact when they add weight to their somewhat misguided arguments? That’s just hypocrisy.
Update (04/02/09 8:51): I took a lot of flack last night because I only tested my examples in FF3. Such is the downside of running nowt but Linux at home these days. However, I’ve had the opportunity to re-test all 5 of my examples this morning and they are absolutely identical in IE6 as they are in Firefox 3.