XHTML is good, actually
2025-04-13
About a month or two ago, I finally converted everything I run and currently maintain to XHTML 1.1. I had been considering it for months and finally decided it was the right decision, and came to the conclusion that XHTML is far better than HTML.
An open web needs real standards
Unlike the SGML-based HTML, documents in XHTML must be valid. Browsers will let you get away with some mild errors, but it's far less lenient than normal HTML. While this is one of the most common things people criticize XHTML for, it's a good thing. Had everyone used XHTML and followed its standards when it first came out, maybe we wouldn't have the browser monopoly we have today, or at least not to such a severe extent. The web needs well-formed XML documents, not the sloppily thrown together garbage HTML allows and borderline encourages. At the start, XHTML was designed with the intention of fixing this, but many people kept clinging onto their shitty documents. Now so many pages are still so annoying to parse that only a couple companies actually do it. XHTML could've helped fix this.
XHTML tags must be properly closed, so it will not let you use <br>
instead of <br />
. XHTML
will not let you uppercase your elements and attributes, so you can't <IMG SRC=
. XHTML will not
let you mess up nesting (even though some browsers will), so you can't (or at least shouldn't) do
the following:
<p>
Here's a list of some things
<ul>
<li>Item</li>
<li>Item</li>
</ul>
</p>
As much as people like to make fun of this, it's a positive to have well formed documents be enforced.
Your own sanity
XHTML forcing documents to be well formed isn't only good for maintaining a true standard, it also helps you, the author. By requiring everything be valid, it strongly discourages poor formatting, leaving it easier for you to maintain your site and edit in the future. Using XHTML puts you in better habits for writing sites and it's yet another reason why its strictness is a good thing.
Negatives
As XHTML is an older standard (the oldest full release being the second edition of XHTML 1.1
in late 2010), it misses out on some newer features HTML5 and others brought in. It doesn't have
<summary>
or <details>
, it doesn't have semantic elements like <main>
(though I don't
really think this matters as much), and it doesn't have inline SVG. I don't think any of these
are really an absolute necessity, but the <summary>
/<details
> tags would be pretty nice.
Further reading
This will be expanded if/when I find more relevant articles.