Chapter 18. XHTML

When people say XHTML is the new HTML, it is not in the sense that fashion pundits might say brown is the new black; it is the W3C's replacement for HTML. Rather than create HTML 5, the W3C made XHTML, which is akin to Macromedia creating Flash MX instead of Flash 6, or Microsoft releasing Windows XP instead of Windows 2001. XHTML is actually the reformulation of HTML 4 written in XML, so you have a few new rules to learn, the first of which is that it shall be XML-compliant.

The good news is that the elements and attributes available to you in XHTML are almost identical to those in HTML 4 (after all, XHTML 1.0 is a version of HTML 4 written in XML), so you won't need to learn a new vocabulary in this chapter. There are, however, a few changes related to how construct documents, which is what you will learn in this chapter.

While XML is finding its way into many aspects of programming, data storage, and document authoring, it was primarily designed for use on the Web. It isn't surprising, therefore, that the W3C wanted to make these changes to HTML (the most widely used language on the Web) to make it an application of XML.

Why do you need to learn a new version of HTML? After all, existing browsers will continue to support HTML, as we know it, for the foreseeable future (and many sites on the Internet may never be upgraded). In fact, this chapter covers several reasons for upgrading old HTML pages, including the following:

  • It can make your page size smaller and your ...

Get Beginning XML, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.