Why You Shouldn’t Be Using XHTML

Tuesday, October 7 by Daniel

A lot of people these days are using XHTML. Why? Do they actually need it or are they just following a trend?

What is XHTML?

XHTML stands for eXtensible HyperText Markup Language. It is basically a way to use XML (If you do not know what XML is you should NOT be using XHTML) in web documents. In the interest of keeping this simple XHTML’s true uses will not be covered in-depth in this article, this will be more about the instances in which you should NOT be using XHTML.

Misconceptions Galore

Many Web Designers use XHTML for every single webpage they code, right below their doctype declaraction (at the beginning of every page) they simply add:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Essentially what the text/html part does is tells the web browser to parse the XHTML code as HTML. Effectively turning the XHTML markup into HTML. So why do these designers/developers use XHTML in their documents? The simple answer: They shouldn’t.

Many are led to believe that it is somehow “better” and that they should be using it over HTML because it is “Stricter”. You may think closing <img> tags like this: <img /> is “stricter”, in reality when you use a TEXT/HTML content-type, the browser’s rendering engine converts your <img /> to <img>. Not so strict now, is it?

Regardless of the way it seems, XHTML simply uses different syntax, not stricter syntax. These superficial syntax changes are simply because XHTML is based off of XML syntax, while HTML is based off of SGML syntax.

If browsers read my XHTML as HTML, why not continue using XHTML?

  • You are misusing the markup language, similar to the way people still use tables for their layouts.
  • It takes more time to code to XHTML strict doctype.
  • Longer load times. A browser has to transform your XHTML markup into HTML markup while rendering the page.
  • Lack of browser support. No version of Internet Explorer to date has had any form of support for true XHTML. (it does render text/html under an XHTML doctype, but as discussed earlier, that is simply telling the rendering engine to change all the XHTML to HTML.) Firefox also has dismal true XHTML support.
  • It teaches you bad habits. once HTML 5 is released you will have to relearn things (of course HTML 5 will have a plethora of new features to learn anyways, so maybe this is a diminshed point.)

The Future of XHTML

To be frank there isn’t much of a future. The HTML 5 Specification is being developed with XML features, when it debuts, XHTML will no longer serve a purpose, even to those who use it properly. HTML 5 isn’t a specification yet and already browsers are starting to support features from it, it will be given a much higher support priority among the major web browsers than XHTML 5 when it comes out. Right now you should definitely stick with HTML 4.01 STRICT!

A Closing Note

I’m aware MagnusFx uses XHTML, I developed it initially to avoid errors with wordpress’s own XHTML output. The theme is currently being recoded under an HTML 4.01 Strict Doctype!

I hope you enjoyed this article, I’m aware my code articles are becoming a bit rare, it seems you guys enjoy Photoshop tutorials more than anything, however I do have a few of these in the wings for rainy days. If you enjoyed this article and you haven’t already, use the email form below to subscribe to our new articles!

Comments

  1. Jt Hollister Says:

    Good article Danny.

    For the record, I enjoy your code articles exponentially more than the Photoshop tutorials. Same goes for inspiration. Photoshop tutorials are all well and good but they show how to do one specific thing, what could be more helpful in the Photoshop area is covering the concepts of design and tools that you can use in a variety of scenarios, not just one particular effect. Not saying the specific ones are bad, however.

    My #1 practical reason NOT to use XHTML unless I need it: it takes extra time to type the /> and the code looks uglier. These issues might not hold a lot of water compared to standards and accessibility, but why go to the extra effort for NO DAMN REASON?

    I’m glad to hear you’re recoding as HTML 4.01! If you don’t run into too much trouble let me know because I want to do the same for my blog, I cringed to have to use XHTML for that!

    You should do an article about HTML 5 and CSS3. I know there’s a lot of info about it on Google, but a lot of the information is highly technical. What are the practical changes for the average web designer/developer? What kinds of things will we have to re-learn to continue to be effective?

    The “good” news is, no matter how much new stuff there is, we probably have around 2-20 years to wrap our minds around it until Microsoft gets around to supporting it!

  2. matt Says:

    hahahah wow this is perhaps the funniest reasons why.

  3. Danno Says:

    I learned some neat stuff here. Cheers.

  4. Ben Swift Says:

    HTML is less accessible, is it not, and I wouldn’t use these anyway. But you do make a valid point ;)

  5. Cal Says:

    HTML is less accessible, is it not, and I wouldn’t use these anyway. But you do make a valid point ;)

    Most uninformed comment ever - subtract 1 million points

  6. Daniel Says:

    Ben, accessibility doesn’t really come in as a factor in this discussion, I’m not sure where you got that idea from! Thanks for the comment though.

  7. چرا نباید از XHTML استفاده کرد ؟ — وبلاگ داتیس دیزاین Says:

    [...] اینترنت به مطلبی در مورد استفاده نکردن از XHTML برخوردم و وقتی خوندم به نظرم دلایل خوبی بود که نباید از [...]

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>