The Inquisition War / The Vampire [...] >>

<< Finding a convenient way to watch [...]

2006-12-27: XHTML? Strict? Choosing a DOCTYPE you can live with...

0 comments

Categories: All Tech

The current markup language standards (at time of writing; end of 2006) are HTML 4.01, XHTML 1.0 and XHTML 1.1 — and each of the first two are available in Strict, Transitional and Frameset versions, though Frameset is rarely used. These standards have been around for years, and even if new standards come tomorrow they won't work in current browsers... in other words, they're what we're stuck with for a long while.

Specifying a language and a version means that when people come along in the future they don't have to guess as much how to display your document. In the here and now, if you don't specify a DOCTYPE (also known as a DTD) and validate documents against it, your pages will be rendered in "quirks mode" — which can make troubleshooting layout problems in different browsers a lot more difficult. And catering to as many browsers as possible is common sense; you wouldn't answer 10-15% of phone calls with an immediate "fuck off, you've got the wrong type of phone" ... would you? Particularly when it's easy to cater for most people, and writing clean markup to standards also helps to improve search engine ratings.

But which one, and which version? What follows is my thinking process.

Reasons to use XHTML:

Reasons to not use XHTML:

A reason to use a Strict DOCTYPE with XHTML 1.0 or HTML 4.01:

A reason to avoid XHTML 1.0 Strict and HTML 4.01 Strict:

Where does this leave us? I'm inclined to validate as HTML 4.01 Transitional but code to the same standards — closed container tags, avoiding presentational attributes, not using tables for layout, supplying alt text for images, etc. — as (X)HTML Strict. The advantages offered by separating content and presentation aren't exclusive to markup specifications that force it.

I do strongly suggest specifying a DOCTYPE and validating. But don't worry too much about which standard you're validating against, as long as what you produce does. It's actual quality of code that's important.


Older entry >>

<< Newer entry

ADD COMMENT





[verification image]
Please type the security text as shown to the left