Standards, schmandards, as long as it works

2/6/07

I’m going to geek out about web standards for a bit.

A List Apart is one of the biggest proponents of web standards. It’s a noble goal; I get what they’re trying to do, and support the idea in principle. In practice, though…

Well, their most recent articles demonstrate what I mean.

On the one hand they have an article on how to create multicolumn layouts using CSS. This is a task that’s trivial to do with a <table>: one row, three columns, set the widths as needed; the source code is compact and easy to read and works identically across all browsers.

But to the web standards zealot, Tables are a de facto Bad Thing. They are Not To Be Used For Layout. Pure CSS is the only way to go. It’s surprisingly difficult to do a multi-column layout using pure CSS, though; current attempts run into hundreds of lines of code, including confusing, complex workarounds and browser-specific hacks that need to be updated whenever a new browser comes out. And they still don’t work perfectly. The code described in the List Apart article is simpler than many, but contains many limitations: the side columns must be fixed width, and can only have a solid color background, no images. Yet somehow it is considered better than the version that actually works.

Example number two: embedding flash in a web page. This, granted, is a task that is much more stupidly complicated than it needs to be, which is what happens when code collides with lawsuits. There are a number of different ways of working around the problems caused by that lawsuit; this article steps through several of those methods, repeatedly dissing the methods that work because they are not standards compliant, and praising methods that don’t work, because they are.

This sort of thing happens over and over with the standards zealots — I just don’t get the mindset. I’m a fan of things that work. Things that don’t work, not so much. Even if they’re theoretically, formally, “better.”

I’m not dismissing web standards, or saying they’re a bad idea. I like CSS and DOM scripting, I use them both, and I understand that separating presentation from content is a good thing. But the reality is, browser support is uneven, and there are some omissions in the specs that make certain tasks difficult or impossible. In those cases, I’m going to revert to the method that works, instead of spending hours searching for a fragile, complicated method that works most of the time and claiming it’s better because it meets some philosophic ideal.

My name is Daniel Beck, and I use tables for layout.

Not all the time. Only when they’re better. I think any responsible web developer should be doing likewise.

The more I look at the problem, the more convinced I am that inside the browser is the wrong place to do the separating content from presentation.

If you’re running a website of any reasonable size at all these days, you’re using some kind of content management system. That CMS has a template system. That’s where you should be doing your separation of presentation from content. There, it’s happening on the server, in an environment you control; if you wait until the content is handed off to the browser to combine those layers, you’ve got a lot less control, since you have to depend on dozens of different browser and platform combinations to work. CSS can be one of the ingredients in that template system, to the extent that it simplifies things. Once it starts getting more complicated than a plain HTML method, it’s time to step back and ask yourself whether it’s necessary to add that complexity.

Personally I don’t think the geek cred of being able to throw an XHTML doctype on my pages outweighs the value of having a site that works and is easy to maintain. Maybe that’s just me.