CSS or Tables?

Volume 7, Issue 85; 18 May 2004; last modified 08 Oct 2010

A few thoughts about CSS, tables, and the mechanics of page layout.

We do not know the past in chronological sequence. It may be convenient to lay it out anesthetized on the table with dates pasted on here and there, but what we know we know by ripples and spirals eddying out from us and from our own time.

Ezra Pound

Technorati lead me this morning to CSS considered hurtful (sic) by Peter Sefton. He’s been waiting for me to write another piece on CSS.

Peter points to an essay by Andy Budd where Andy plays devil’s advocate for the table paradigm.

I have a few comments.

  • I’m not a rabid CSS fan. I didn’t convert to CSS because I think it’s universally the right choice. In fact, I haven’t converted several other sites I maintain because it hasn’t seemed worth it.

  • The folks who do accessibility for a living make some good arguments about the practicality of using tables for accessible layout.

  • In point of fact, using CSS here has several distinct advantages that contributed to my conscious decision to switch to CSS for this site:

    1. Wide objects, like program listings, really make a mess of table-based layouts. You wind up with some huge column and a horizontal scroll bar with all the other columns pushed right off the screen. By the same token, the CSS approach sometimes leaves one area overlapping another, but

    2. A little JavaScript allows me to provide the “Style: 1 Col / 2 Col” links that let you switch off the navigation and get a nice clean single-column design in those cases.

    3. The content is naturally linearized. If your reader doesn’t understand CSS, or if visual layout is a foreign concept to your reader, you’ll be presented with the essay followed by the navigation which is exactly what I (the content author) want to present in that case.

  • Frankly, the fact that the style is separated from the content seems perfectly reasonable to me.

Comments

Hi, got here from an off-topic link in a google search.

Just in case you have a mailer or look back on this someday, I'd like to point out that CSS is NOT a table replacement scheme. There are a lot of folks out there who dislike tables and would like to use CSS to replace them, but it's not anywhere near a rule.

I use CSS with tables just fine. CSS is all about separating the layout from the content. And it makes code cleaner. A site converted from plain HTML to one with a stylesheet uses half or less code, less tag attributes all over the place and no more useless tags. All fonts, colors, styles and ecetera are all globally controlled from the one CSS file.

—Posted by Tim on 21 Mar 2006 @ 11:27 UTC #