XHTML and Document Validity


All XHTML documents must specify a document type definition, or DTD, which is used to identify XHTML as the language for the web page. In XHTML 1.0, the W3C developed three different DTDs, which are all included in the XHTML specification. These DTDs provided varying levels of detail for XHTML, which resulted in three different classifications of XHTML documents. The idea was that you could use a more minimal XHTML DTD if you didn't need to use certain XHTML language features, or you could use a more thorough DTD if you needed additional features. The three XHTML 1.0 DTDs were classified as shown here, in order of increasing features:

  • Strict No HTML presentation elements are available (font, table, and so on.); style sheets must be used to format documents for display.

  • Transitional HTML presentation elements are available for formatting documents.

  • Frameset Frames are available, as well as HTML presentation elements.

The Strict DTD was a minimal DTD that was used to create very clean XHTML documents without any presentation tags. Documents created from this DTD required style sheets in order to be formatted for display. Not surprisingly, this is the DTD that would later form the basis of XHTML 1.1; more on that subject in a moment. The Transitional DTD built on the Strict DTD by adding support for presentation tags. This DTD was useful in performing a quick conversion of HTML documents when you didn't want to take the time to develop style sheets. The Frameset DTD was the broadest of the three DTDs, and included support for creating web pages with frames.

XHTML 1.1 did away with the three different DTDs and instead went with a single DTD that is very similar to the XHTML 1.0 Strict DTD. The idea is that you should be focused on separating content from formatting in XHTML 1.0, which means you should be using style sheets instead of the old HTML presentation tags. This book focuses solely on XHTML 1.1 and its strict approach to creating highly structured web pages.

You must declare the DTD for all XHTML documents in a document type declaration at the top of the document. A Formal Public Identifier (FPI) is used in the document type declaration to reference the standard XHTML 1.1 DTD. Following is an example of how to declare the Strict DTD in a document type declaration:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"   "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 


It isn't terribly important that you understand the details of the FPI in this code. The main point is that it identifies the XHTML 1.1 DTD, which is required of all XHTML 1.1 web pages. You should hopefully recognize this code because it appears at the start of every sample web page in this book. Keep in mind that the significance of the document type declaration is that you must place it at the top of every XHTML web page that you create in order for it to qualify as a valid XHTML document.




SAMS Teach Yourself HTML and CSS in 24 Hours
Sams Teach Yourself HTML and CSS in 24 Hours (7th Edition)
ISBN: 0672328410
EAN: 2147483647
Year: 2005
Pages: 345

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net