XHTML vs HTML 4.01, Which to Use
If you’re like me, you just want to save time and have a professional web designer and coder just tell you what you should be doing. Unfortunately life is almost never that simple…
I have heard some of the differences between XHTML and HTML 4.01 but haven’t taken the time to really make an educated decision. I’ve done the research now, so I can make the educated choice and advise appropriately. I’m going to make this very easy for you and most importantly help you understand the important differences.
The short answer? You should be using HTML 4.01
Why? The easy answer to that is actually pretty simple. Here’s a list:
- Current versions of Internet Explorer don’t support XHTML
- You won’t be using the extra features in XHTML. If you actually are going to use them then you know the differences between XHTML and HTML 4.01 and won’t be reading this.
- Most likely you are setting your Content-Type as “text/html” in your XHTML document, which means browsers are looking at it like HTML anyway. You have to use “application/xhtml+xml” for browsers to parse it as XML.
Those are just a few reasons. Summary… IE doesn’t support it, you’re actually just using HTML anyway and you don’t need or use the extra features in XHTML.
To answer these next few questions, you should visit http://www.sitepoint.com/forums/showthread.php?t=393445
What is XHTML?
The answer to this is widely mis-understood. XHTML is NOT HTML as you might assume or been lead to believe. XHTML is actually XML with the same element types and attributes as HTML 4. They are closely related but they are not the same. http://en.wikipedia.org/wiki/XHTML
Why do so many people advise the use of XHTML?
For the most part, they are speaking out of ignorance and/or personal preference. What I read most often is XHTML is for the future (false) and that most people like the syntax rules better (which is ignorant). It was an exciting and promising technology in the past but turned out not to be future proof, etc. The publicity of the downfall of XHTML wasn’t as widespread and thus, people still use and recommend it.
What are the differences between XHTML and HTML 4.01?
This question is a little more complicated. Because I think most of you reading this article don’t really care about the XML stuff or the more technical differences, I’ll make this a shorter and simpler answer via bullets:
- XHTML is case sensitive but HTML isn’t.
- XHTML requires end tags or self closing tags, not always the case with HTML
- Error handling is more forgiving for HTML
- XHTML requires a value for attributes
- Comments in XHTML are more limited
For additional differences besides syntax, visit: http://www.sitepoint.com/forums/showthread.php?t=393445
Conclusion and recommendations: Use HTML 4.01 Strict. It will be ready for the future, works in all browsers and is actually easier to code with (just a tiny bit). Educate yourself on the differences. Here is a fantastic resource: http://www.sitepoint.com/forums/showthread.php?t=393445 and here: http://en.wikipedia.org/wiki/XHTML Also, the World Wide Web Consortium recommends the use of HTML 4.01 over XHTML, if you don’t trust me that’s fine but at least trust them.
Another fantastic read is: http://www.webdevout.net/articles/beware-of-xhtml It explains the differences between XHTML and HTML and why HTML should be used at least for the time being.
RSS feed for comments on this post. TrackBack URL







A lot of this is good stuff, some of it I didn’t know. However, be careful of sitepoint and other’s opinions on this as sometimes if you’re working with a dynamic application, like a CMS, the application will require you to use XHTML 1.0 (transitional).
Ricks last blog post..XHTML vs HTML 4.01, Which to Use
Thanks Rick, I didn’t know that. Until now I’ve used XHTML Strict and haven’t had any problems but I primarily only build web templates and don’t get into CMS’s too often.
I think for most people, by the time they start working with CMS’s they should know the pro’s and con’s of both XHTML and HTML 4.01 and will know which to use for each project.
Thanks again!
While there is some truth in what you said there are many different reasons one would use XHTML beyond being ignorant (I understand that sitepoint state “ignorant”). You pointed out most of the reasons why one would want to use XHTML and for myself, my last employer used lots of XML (for stupid lazy reasons but we still used it) so I got in the habit of it. The big thing to note is that the W3C does recommend XHTML 1.0. Here is the link for reference. http://www.w3.org/MarkUp/#recommendations
chads last blog post..XHTML vs HTML 4.01, Which to Use
Hey Chad, thanks for the comment!
XHTML is based on HTML 4.01 so unless you need XML, what is the point? The problem is that if you’re new to web coding, it’s probably better to start using XHTML as it requires cleaner syntax. But once you’re very familiar and comfortable with the XHTML syntax, you might as well use HTML 4.01 and just use the same syntax as in XHTML.
Overall, in the end, I don’t think it’s really going to matter which one is used so long as things are coded properly, lol.
This was an excellent post. Like Rick said, some of this I didn’t know as well.
First time visitor to your blog. I found the link on Blog Catalog when doing some research on one of my own posts.
It’s kinda strange to recommend html 4.01 strict on a web page that is using xhtml 1.0 transitional.
lol, indeed.
XHTML is used by default when downloading WordPress. The previous theme I was using was transitional (downloaded and customized). When I built this theme I used the same structure as the old theme and rebuilt it but forgot to change the doctype. Thanks for reminding me though, I’ve updated it for XHTML Strict. Why not HTML Strict? Because it doesn’t need to be.
I’ll change it when I finish building this theme though. haha