VI. How To?
6.3. Page Structure
6.3.1. HTML and XHTML
Often XHTML is associated to CSS layout and to accessibility. This is some kind of a myth. Often I have read on forums or books that users do not want to use HTML 4.1 because it was older, less handy, or less adapted to CSS than XHTML 1.0. Critics generally concentrate on the facts that:
- HTML is a less strict language than XHTML, which is true: HTML allows, for example, to not close tags; but it also allows these tags to be closed, it is up to the developer to adopt the same strictness in coding.
- HTML uses deprecated tags. And XHTML too, both languages do, under a Transitional doctype; and both forbade deprecated tags under a strict one.
- XHTML is the new standard of HTML. This idea has been promoted by several authors such as Pfaffenberger, Schafer, White and Karow, in their book: HTML, XHTML, and CSS bible where they wrote: “Apart from a minor update (HTML 4.01) in 1999, HTML 4.0 is the last version of HTML. That’s because it has been replaced by XHTML, which is the version of HTML you’re going to learn in this book” (Pfaffenberger, Schafer, White, Karow, 2004). XHTML is not a new version of HTML, it is a cross-breed between HTML and XML.
- “XHTML is part of a family of web standards (also including CSS and the W3C Document Object Model) that let you control the behaviour and appearance of web pages across multiples platforms, browsers, and device” (Zeldman, 2003, p151). HTML is also a standard, defined by the same organism that defined the XHTML as a standard; and HTML can also let the developer control the behaviour and appearance of web pages.
- “New browsers love XHTML (particularly XHTML 1.0), and many accord it special treatment, not granted to pages authored in HTML 4. This makes XHTML more predictable than HTML in many cases” (Zeldman, 2003, p151). In 2003, when Zeldman wrote these lines, the most commonly used web browser was Internet Explorer 6, which still has problems interpreting XHTML (when is it delivered as a text/html).
Actually, HTML and XHTML are two different standards that do not offer the same functionalities and that have different usages. In terms of Accessibility, the use of HTML or XHTML brings the same benefits, and the same inconvenient. The most important is not really the choice of language, but the choice of DTD, or doctype, which specify the language used to create the page, its version, and its mode of execution, which is the most important. There are three types of execution mode: Strict, Transitional, and Frameset. The strict doctype is recommended, indeed, it corresponds to the actual standards of the language used; the Transitional doctype allows the use of deprecated tags such as font, and should only be used, as its name indicates, as a transition from a doctype-less page to a strict valid page; the Frameset doctype is not recommended, it allows the use of frames to build the page, which is an important accessibility flaw.
HTML 4.01 Doctypes:
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"> - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
XHTML 1.0 Doctypes:
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">