"Behind the Scenes"
|September 2012||The monthly newsletter by Felgall Pty Ltd|
HTML 5 or XHTML 5
Just about everyone who creates web pages should be aware by now that there is a new version of HTML in development which may eventually become the new standard version and which newer browsers support at least in part. What may not be so obvious to some people is that there are actually two new versions being developed in parallel because there is an XHTML version being developed as well as the HTML one.
Perhaps one of the reasons why this isn't as obvious to many is that they both use the same doctype. With the current standards - HTML 4.01 and XHTML 1.0 - the HTML and XHTML versions each have their own doctype and because of this a lot of people gained the mistaken impression that the difference between HTML and XHTML is the different doctypes used. This is not the case and there are a huge number of HTML pages on the web that use the XHTML 1.0 doctype. All (X)HTML 5 is doing in this regard is recognising that the browsers actually ignore most of the content of the SGML doctype tag and simply use it as a switch to determine whether to display the page in standards mode or quirks mode (quirks mode in Internet Explorer meaning that the draft CSS 2 version that existed at the time IE5 was released gets used instead of the final standard version where a number of changes had been made).
XHTML 1.0 is basically HTML 4.01 rewritten so that it is also valid as XML and in the same way XHTML 5 is the valid as XML variant of HTML 5. Perhaps the most noticeable difference between HTML and XHTML is that XHTML requires that all tags be closed including those which in HTML are not allowed to have a closing tag. While HTML only provides one way to close a tag, XHTML provides two different ways and so the HTML <hr> tag can be written either as <hr></hr> or as <hr/> in XHTML (whether version 1.0 or version 5). The second of these is the one more commonly used because it is both shorter and it can be served as HTML as all browsers except Netscape 4 will simply ignore the invalid slash at the end of the tag (you can even get Netscape 4 to accept it by inserting a space before the slash but since Netscape 4 is long dead there is no reason for doing so any longer).
The actual difference between HTML and XHTML (whether 4.01/1.0 or 5) is the MIME type used to serve the page. A MIME type of text/html indicates that the page is HTML regardless of which doctype is used) while a MIME type of application/xhtml-xml indicates that the page is XHTML (and so must have an xmlns attribute on the HTML tag and must close all tags and all the other minor differences applicable to XHTML). Few people actually serve their pages as XHTML at the moment but the reason for that is that Internet Explorer 8 and earlier do not support XHTML.
Things should be completely different by the time that (X)HTML 5 finally becomes a standard. By the time that all browsers actually support the new HTML 5 standard, thy will also support XHTML 5 since by then IE8 will be long dead. So implementing pages using XHTML 5 will be just as practical as implementing pages using HTML 5 at that time. Those suggesting that HTML 5 has killed XHTML are completely wrong. If they were right then why is XHTML 5 being developed in parallel with HTML 5?
The following links will take you to all of the various pages that have been added to the site or undergone major changes in the last month.