Why XHTML?

Thursday Apr 7 2005

I guess quite a lot of us know it. Web standards. It's cool to be part of the gang that actually cares about them. It feels great to see those blue colors of validity on the validator when you click the 'Valid XHTML' button on your site. You're a web developer that cares. Aren't you great? You're part of the "valid XHTML" community and you can proudly display whatever badge or button on your site to tell the world all about it. And as if that's not enough, you're not only using valid but valid too, and you killed all the poor tables in the process. Tables are evil. They needed to die! So here we are with our shiny valid XHTML websites with a "CSS Zen Garden-worthy" CSS layout. But why really?

<devils advocate mode="exaggerated-but-honest">

Dark Matter Pro: a premium photoblog template.

Affiliate program available

Web standards make your site work in many browsers


This is an often heard argument. However there are things to say. First of all, standard HTML 4.01 works just as well in 'many browsers' as XHTML 1.0 or 1.1. I don't think any browser vendor will bring up the idea of dropping HTML 4.01 support in many years to come for the simple reason that it would break way too many sites causing no one to use this particular browser. Therefore HTML isn't gonna go away any time soon. Also, HTML saves bytes because you don't have to close all your tags in order to be valid. Let's face it, adding extra slashes to tags or adding closing tags doesn't really do anything in the real world except for the w3c validator to tell you how much your code rocks for being valid. Sure the extra couple of keystrokes don't hurt but one can argue about their real world use. If we combine the quite probably assumption that HTML 4.01 isn't going away any time soon with the fact that most websites are relatively short-lived (3 years is already very long for a site to remain unchanged) we can quite safely assume that there's absolutely no reason or whatsoever to use XHTML.

Table layouts suck! go semantic XHTML with CSS or we'll shoot this dog!


I have mixed feelings here besides feeling really sorry for that dog. In fact it's true that, once you know all the ins and outs of CSS it's easier to get designs transformed from photoshop to real webpages if you use the modern CSS way of creating your layout templates. However it takes considerable time to learn it and once you do you'll find that the no. 1 browser on the market doesn't really play nice with your perfectly valid XHTML website. In order to get it to look right we're forced to use all kinds of dirty hacks to get it to work in this particular browser. Now I wonder, don't these hacks sort of defeat the purpose of 'wanting to do it right' ?

The good old 'table layout' may be blasphemy in the eyes of us webstandards-loving developers but honestly, most sites that use it work absolutely fine in all browsers. Heck, they even work in really old browsers such as MSIE 4 while our shiny new XHTML/CSS designs fail horribly in them. It's something to keep in mind especially if we're creating webpages for audiences in under-developed countries who are surfing the net on trailing-edge hardware.

Accessibility


Accessibility is a hot issue these days. We need in order to get our message through to our blind or otherwise disabled audience. The semantic principles however apply quite well to HTML 4.01 as well. There's no clear reason to use XHTML in order to build an accessible website that I can see.

So...


So far I haven't found any really compelling reasons to use XHTML. To make things worse, those who use it, including me, are actually doing it wrong because we're not serving application/xhtml+xml but text/html! This makes the whole thing sort of a moot point if you think about it. It's like serving a JPEG but telling the browser it's going to get a GIF and assuming the browser will be smart enough to discover what it actually is we're pushing down it's throat. There are some advantages to a CSS based layout compared to the old school table based layout but for many purposes it really doesn't matter as much as people want us to believe. I think I've covered most widely used arguments but they're rather 'thin' at best.

So explain all this CSS and XHTML vanity stuff here then will you?


Don't get me wrong. I love to work with web standards, XHTML and CSS based layouts. It brings out the geek in me, wanting to create perfect code and perfect design. I guess it's also a sign of quality. It shows that the guy who made it knows what he's doing. He's been there, he's done that. He's meticulous and precise. His PHP application code will probably look just as clean. Now let's hire him!

I'm simply questioning the real-world value of it all. To me the best and most honest reason for using all this fashionable web standards / css stuff is simple and down to earth: because I can! That's all there's to it really.

Happy (X)HTML-ing!

</devils advocate>
bookmarking

Commentary

Join the discussion! Leave a comment through the comment form below!

Got something to add to this?

Feel free to leave a comment on this site. You can use Textile and Emoticons. Your email address is only used to show a gravatar. Please stay on-topic and use common decency. Spammers will be shot in front of a live studio audience.

If you plan on posting code, use pastebin please and post a URL to the code. The comment processing doesn't deal very well with code. Sorry for the inconvenience.

Human comment spammers: don't bother posting your crap here. Comments are moderated and I won't let any of your shit through.

Remember personal info?
Yes
No

Trackbacks

If you have an interesting related post on your own site you can leave a trackback. As they say: 'a little AJAX a day keeps the spammers away' which is why you'll have to click below to generate a trackback key. The key will be valid for 15 minutes and can be used only once.

 

  • Featured Links
RockySomewhere near the Orion NebulaBookalicio.usGolden Gate BridgeThames River BankJackie and mePimpin' it