Back to HTML?

There have been a couple of controversial posts flying around lately… I thought I’d add my two cents…

Should we go back to HTML 4? The argument is that XHTML hasn’t really delivered on the promises of a semantic, extensible web, and probably won’t do so in the foreseeable future; instead HTML 5 is starting to look like the next holy grail (I have some views on HTML 5 in an earlier post). So let’s ditch XHTML and get ready for HTML 5 by jumping to the latest HTML version (that’s 4, if you’re still with me).

Hold on, what?

My new watch doesn’t tell me the time in five different timezones, so I’ll go back to using my old sundial because there’s a new type of sundial in the making that will! My mobile phone doesn’t have great coverage so I’ll use my old fixed phone instead! Ubuntu doesn’t support DRM’d desktop background images, but the next version of Windows will, so I’ll switch back to XP…! OK, OK, maybe I’m stretching comparisons somewhat, but the basic premise remains: why would you go back to something that has more disadvantages right now when the reason for doing so has nothing to do with it? There’s nothing to gain.

First off, HTML 5 will maintain XML compatibility in its XHTML 5 incarnation. The current spec doesn’t dwell much on it, because in terms of DOM there should be no difference between the two. The strict parsing and reconciliation rules guarantee that. If you use the XHTML version you get the additional XML validation — if you want it. But HTML 4? There are no such rules, it is easier to write non-conformant code that renders completely differently in different browsers. The syntax is lax, and therefore more prone to breaking. In short, rules in XHTML are much clearer. So, although HTML 5 will address a lot of the bad effects of malformed documents, XHTML (whichever version) helps to address the causes.

If the argument is that you want to line up your markup with the new HTML 5 tags like <nav>, why wouldn’t you do so with XHTML? Here’s the difference:

<!-- HTML 4 --> <div> <ul> <li>... <li>... </ul> </div> <!-- XHTML 1 --> <div> <ul> <li>...</li> <li>...</li> </ul> </div> <!-- (X)HTML 5 --> <nav> <ul> <li>...(</li>) <li>...(</li>) </ul> </nav>In case it wasn’t clear: I’m sticking with XHTML 1 for now, thank you very much. I shall jump to XHTML 5 when I feel it’s time; I like to close my tags.

I had something else to say about using px as font-size units, but I’ll save that for a later post… Don’t want to rant too much…

Leave a Reply