Validation
XHTML vs. HTML
This site really is XHTML 1.1 (which will be served to you properly if you’re using a Mozilla variant) and CSS 3 compliant. Woo!
I’ve decided not to go that route anymore, as I don’t see the point in
serving these documents as XHTML 1.1 and MIME type application/xml+html when only Mozilla
variants support it. It was nice to be forced into ensuring everything was
well-formed—the browser would puke a pretty nasty error if the page
wasn’t—but it’s overkill for what I do here. I used some server-side
content-type negotiation to serve plain HTML to browsers that didn’t accept
application/xml+html, but it was just a headache. It even turned all the empty
/>
closing tags back into >
before serving the page up. I
thought that was a nice touch.
Instead, I’ve opted to go with DOCTYPE XHTML 1.0 Strict and serve the pages as text/html. This allows me to be a bit ahead of the curve and future-proof things as well as provide adequate fallback for an older set of user agents I actually care about. Any Netscape 3 users out there? I hope not, because that didn’t even support CSS.
I noticed the The Web Standards Project as well as a random sampling of some w3.org pages are currently serving XHTML 1.0 Strict as text/html, so I am definitely in good company.
The W3C has this to say, in a great article on this subject:
XHTML 1.0 can be served as HTML or XML. If you serve it as XML, use the MIME type application/xhtml+xml.
They also offer some excellent guidelines to follow when serving XHTML 1.0 as text/html, all of which I have followed.
Tools
If you’re a total dork for this sort of thing like I am, there is a fantastic extension available for Mozilla-based browsers that uses HTML Tidy to check the current page’s validity at a glance without using the W3 Validator. I use the extension for a quick visual, but the W3 Validator for all final checks.