Advertisements
Why You Shouldn't Be Using XHTML
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.