xhtml to pay
By Todd Stadler · Thursday, February 28, 2002 4:20pm
You might be wondering why I decided to use style sheets and XHTML for the redesigned Cock-a-hoop.
Of course, I know you're actually not wondering that, but you might be, and that's what keeps me typing away here, so please don't say anything until I'm done.
You're very polite. Thank you.
Anyhow, the big reason behind XHTML is simple - it's just like HTML, only it has rules.
Really, that's it. You might think HTML has rules, but only in the same way that English spelling has rules. Sometimes you can do things several ways, sometimes not, and people generally know what you're talking about and let it slide.
The nice folks at the New York Public Libraries have a very nice style guide that explains the why and how of XHTML, should you want to know more.
Of course, the stricter rules of XHTML don't allow for much in the way of attractive presentation, so it was necessary to use style sheets to purtify things.
But style sheets do more than simply make a page look pretty. They make it possible to separate content from presentation.
Now, maybe that ranks right up there with the ability to eat sand for you, but I (and the zealots I've been listening to) find that important because you never know what'll be looking at your web page these days.
It could be a normal web browser, a text web browser, a cell phone, a printer, an evil robot bent on destruction, a browser for the blind, or something that I'm not yet aware of.
It'd be really annoying to code up a different page for every one of these browsers. With CSS, I don't have to. I just code the XHTML, and then make a style sheet for different browsers.
Even if a particular browser can't read style sheets, at least they have the relatively clean XHTML to read, so the content isn't obscured by how it's displayed.
(Ah, ah - wait! You're still not allowed to complain yet. But I'm almost done with this article. Again, thank you for being so considerate.)
It also means I don't have to waste my time making tables to exacting proportions and stuffing the table cells with images and data to get the site to look just so.
You see, HTML tables were originally created to display - surprise! - tabular data, like in a spreadsheet. But every designer in the late 1990's latched on to their power to align. And in the process produced pages that were slow for browsers to render and slow to download, because the table code was often so very long.
For instance, the calendar somewhere on this page used to be rendered with tables. Now - poof! - it's done using good ol' XHTML/CSS. Which, while far more jargonly gibberishy, makes it a lot faster to download and render. Yay me, yay standards, yay us.
The one big exception to this whole standards-based lovefest is if you're viewing these pages using Netscape 4.x. If you are, then you may notice that you get served up different HTML than everyone else. You get tables.
You also get a rant, below.