XHTML 5 Reference

go to next section

Introducing XHTML 5

The XHTML 1.0 references pages were just about the first pages added to this site back in 2000. Since then a minor change was made with XHTML 1.1 and a completely new version to be called XHTML 2 was started and then abandoned. The new XHTML 5 standard released on 28th October 2014 is therefore the first significant change to XHTML since I first wrote those reference pages fourteen years earlier.

XHTML 5 is not a huge change from XHTML 1.0 (as XHTML 2 was going to be). For the most part XHTML 5 simply adds a number of new tags and attributes to what is already available in XHTML 1.0. Many of these provide new functionality expected on the web today but which didn't really exist when XHTML 1.0 was created but a few simply provide alternative ways of doing the same thing (since so many people still use what were proprietary tags that were supposed to be replaced in pages by the new tag way back in the 20th Century).

Another difference between XHTML 1.0 and XHTML 5 is that at the time of XHTML 5s release the only browser which doesn't support XHTML that has enough people using it to prevent switching to using XHTML is Internet Explorer 8. This means that it should actually be practical to use XHTML 5 for web pages where you couldn't really use XHTML 1.0 because at the time it was created no browser supported it and even when it was replaced by the new XHTML 5 there were still people using IE8 who wouldn't be able to see XHTML web pages.

This reference will follow the same order as the original XHTML 1.0 reference to make it easier to compare the two versions.

The XML Declaration

The XML declaration is optional with XHTML documents. In practice with the use of server side languages, some of which use tags that clash with the XML declaration, this declaration is now omitted from all XHTML documents.

The DOCTYPE statement

HTML 5 is no longer based on SGML and so there is no SGML doctype statement to include with XHTML 5 documents.

The HTML statement

The HTML code within a document must all be enclosed within the following pair of tags: <html xmlns="http://www.w3.org/1999/xhtml> and </html>.

Optionally on the html tag you might include an id or class attribute to allow styles to be attached. The tag may also include xml:lang and dir attributes in order to specify the language and the direction in which the language is read. These attributes may appear on almost any tag within the page.

The rest of the document

There will always be exactly two tags nested directly within the html tag - the <head> </head> are wrapped around information relating to the entire page while the <body> </body> is wrapped around the actual content of the body tag may also have the same four optional attributes as the html tag does.

All of the rest of the page content will be inside of either the head tag or the body tag.

go to next section


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow