Skip to Main Content
HTML & XHTML: The Definitive Guide, 6th Edition
book

HTML & XHTML: The Definitive Guide, 6th Edition

by Chuck Musciano, Bill Kennedy
October 2006
Intermediate to advanced content levelIntermediate to advanced
680 pages
21h 44m
English
O'Reilly Media, Inc.
Content preview from HTML & XHTML: The Definitive Guide, 6th Edition

Well-Formed Documents and XHTML

XHTML is HTML's prissy cousin. What would pass most beauty contests as a very proper and complete HTML document, done according to the book and including end-paragraph tags, might well be rejected by the XML judges as a malformed file.

To conform with XML, XHTML insists that documents be "well formed." Among other things, that means that every tag must have an ending tag—even the ones like <br> and <hr> for which the HTML standard forbids the use of an end tag. With XHTML, the ending is placed inside the start tag: <br />, for example. [Handling Empty Elements, 16.3.3]

It also means that tag and attribute names are case-sensitive and, according to the current XHTML standard, must be in lowercase. Hence, only <head> is acceptable, and it is not the same as <HEAD> or <HeAd>, as it is with the HTML standard. [Case Sensitivity, 16.3.4]

Well-formed XHTML documents, like HTML standard ones, must also conform to proper nesting. No argument there. [Correctly Nested Elements, 16.3.1]

In their defense, the XML standard and its offspring, XHTML, emphasize extensibility. That way, <p> can mean the beginning of a paragraph in HTML, whereas another variant of the language may define the contents of the <P> tag to be election-poll results that display quite differently—perhaps in tabular form, with red, white, and blue stripes and accompanying patriotic music.

We will discuss this further in Chapters 15 and 16, in which we detail the XML and XHTML standards (and the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

CSS Master, 3rd Edition

CSS Master, 3rd Edition

Tiffany B Brown

Publisher Resources

ISBN: 0596527322Errata Page