Well there was me thinking that XHTML was the next big thing that was going to replace HTML. Turns out that’s actually quite far from the truth.
There are a number of issues with XHTML. Here are some of the big ones:
- Internet Explorer (every web designers favourite browser) doesn’t support XHTML at all. You can pass XHTML with an HTML content-type header (“application/xhtml+xml”) but then IE will just treat it as HTML (i.e. wrongly). This includes IE8.
- Most browsers will treat XHTML documents as HTML which basically removes the X (for eXtensible) from XML. It also means that the browser basically thinks your code is wrong (“<br />?” it says, “what’s that slash all about? This is html!”
- It’s not future-proof. A lot of the hype around XHTML is to with it being future-proof, which it isn’t. Firefox, Opera and Safari all support true XHTML 1 (i.e. XHTML served with and XHTML header). Internet Explorer doesn’t support XHTML at all. Since the XHTML specification was released HTML 5 has been started and many people are now basically ignoring the development of XHTML 2 in favour of HTML 5.
Of course XHTML will work most of the time (partly because the syntaxes are so similar) but if you’re trying to find the right way of doing things and you don’t need any of the additional features that true XHTML brings then XHTML probably isn’t for you.
Looks like I need to do some updates… :s
Edit: I’m still pretty unsure about the whole subject to be honest but what I have gathered is that making sure you use a “strict” doctype is more important than whether you use HTML or XHTML-as-HTML. Otherwise you’re basically relying on browser hacks in order to get things working as they should.