Book HomeWebmaster in a Nutshell, 3rd EditionSearch this book

2.3. XHTML

When the W3C defined the Extended Markup Language (XML), they also defined XHTML as a more rigorous, XML-compliant version of HTML. XHTML is designed to satisfy XML rules while still remaining legitimate HTML.

For example, although HTML specifies the <p> tag to start a paragraph, and the </p> tag to end it, you can easily omit the </p>, because HTML browsers will generally infer them. However, XHTML requires both <p> and </p> tags for all paragraphs, without exceptions.

The goal of the W3C is that eventually, HTML will migrate completely over to XHTML. However, that migration is likely to be slow. As long as people who write HTML documents manually can get away with omitting </p> tags and still have browsers parse them without complaint, they will continue to do so.

Most HTML authors today don't really need to worry about XHTML if all they're interested in is having their documents parsed by a web browser. But if you write tools that generate HTML, or if you expect that one day your document might be used in a venue other than the Web, you should take the time to learn XHTML. The differences between XHTML and HTML are trivial compared to the benefits of writing XML-compliant documents.

For more information on XHTML, refere to www.w3.org, or to the book HTML and XHTML: The Definitive Guide.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.