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!
Related Articles
- HTML To XHTMLIf someone just says that this is the high time when you should convert your site from HTML to XHTML - you can halt or not. But if he can say this with proper logic then you must be going through his decision - adaptibility is another thing. So at first you must know basically what XHTML is. XHTML i...
- XHTML vs. HTMLA quick introduction to XHTML
- What is XHTML?We have all heard of HTML. HTML stands for Hypertext Markup Language. What is a hypertext markup language, you ask? It is a language for specifying how certain text should appear. When you design a web page, you want certain content or text to be displayed in a specific way.
- Comprehensive Guide to XhtmlSince some time, the internet has been relying on HTML... or Hyper Text Markup Language... Since its been invented, many tries to replace it have been thought up, but none as successfull as XHTML (eXtensive Hyper Text Markup Language)... lets say that its HTML cleaned up...
- Code Validation & Compliancy - The New Beginning XHTMLCode validation is still widely debated as to whether it is required for performance within the search engines. It is only a guess that the search engines dont utilise it within their algorithm, but nobody is actually 100% sure on that fact...
- XHTML bridges the gulf between HTML and XMLBringing XML to todays HTML-based Web, XHTML justifies the breakthrough label. It will rise slowly but surely. If you take any interest in Web technology, youll have come across references to...
- You Need No Sounds in Web Site DesignI recently received an E-mail from somebody who wanted to ask me about if they should or shouldn
- XHTML and StylesheetsWant to build website content that can be processed by XML-compliant tools? If you answered yes, then its time to learn the rules governing XHTML.
- Why is Validation Important?Validation in your webpages is very important as proven in this tutorial. In this tutorial youll learn about Validation and how you should be making the effort to get validated!
- highlight_string(); With Valid XHTML 1.0 Strict OutputThis small guide aims to take the standard output from the PHP function highlight_string() and make it completely valid XHTML 1.0 Strict.
