I have already written something about XML versus XHTML, to explain the difference between the two. Now, I would like to discuss and explain what the reasons are to choose XHTML over HTML, even if you can’t send it as application/xhtml+xml. This is related to the DTD, I “discussed” yesterday.
On the current web, XHTML doesn’t have that many advantages over HTML. Some people think that it hasn’t got any advantage over HTML, ‘cause the correct content-type for XHTML, application/xhtml+xml, isn’t supported by Internet Explorer (how many times I have written that sentence…). Other browsers, like Mozilla and Opera (includes scripting from 7.5), do support it (Safari as well, I believe). There are ways to send XHTML with the correct MIME type to “good” browsers and text/html to “bad” browsers (like IE), but those methods are rarely used (I just see that Cinnamon is added to the list, great work!).
I think we can state that is the biggest “failure” of XHTML and a point of criticism. A good point (they exist) is the Document Type Definition of XHTML. Where HTML allows you to do:
XHTML is stricter (you have to close the list-item-open tag). A HTML document that looks like the example above has to be “re-mark-upped” by the browser so that the browser can have a normal DOM for JavaScript and CSS. A good example of that is that you may omit both start and end tag of the BODY element, but the CSS type selector body still applies. To tell you the truth, the same parser applies to XHTML documents send as text/html, so it doesn’t really matter that much (now). In the future, however, you can have (I you start writing now) completely valid XHTML documents (or well-formed) and send them as application/xhtml+xml so browsers will render your pages faster (not an extra parser, they expect your document to be valid, et cetera). What I’m trying to say (write*) is that XHTML is more forward compatible.
Did I miss a point? In short: The XHTML DTD is better to work with, ‘cause it is stricter than the HTML one.
[Weblog about Markup & Style]