XHTML?
Recently I built some pages for a client, and one of the client contacts came back wanting to use validated XHTML. The guy in question was all, "It looks weird in IE!"
I cursed under my breath, and then looked at the pages he sent back to me. All he had done was add an XHTML doctype to each page. Running them through a validator produced millions of errors. That's when I decided to read a bit on what XHTML actually does.
Benefits of XHTML
- Stricter syntax rules - always have well-formed documents
Detriments of XHTML
- Stricter syntax rules - more difficult to update
- Needs to be served with proper MIME type; not "text/html"
- View http://www.hixie.ch/advocacy/xhtml regarding serving XHTML as "text/html"
- Not supported by IE
- XML declaration causes "quirks" mode when document is served as "text/html"
- IE doesn't handle MIME type "application/xhtml+xml"
- "Unless the document is recognised as XHTML, you cannot use any of the features XHTML offers over HTML."
Sadly, after reading about all this stuff, I realized that I had been making some unwitting mistakes in my HTML for quite a while now, such as inserting a space and slash at the end of single tags (i.e. <br /> instead of <br>). Plus, I haven't been validating my code... mostly just due to laziness on my part.
Anyway, the long and short of the story is that I learned a lot about doctype declarations, and that XHTML is mostly hype, in terms of accessibility and features. Using the HTML 4.01 Strict doctype will probably ensure that your document will be accessible in its' original presentation for years to come (if you even care that long).
Comments