HTML and CSS Reference
Transitional, Frameset, and Strict DTDs
There are several different DTDs associated with HTML and XHTML documents. Some
DTDs represent older versions of HTML. For example, if you want to create a document
that is validated only against the standards of HTML 2.0, a DTD is available for this
purpose. However, for Tom's document, you'll focus on the following DTDs used with
• transitional : The transitional DTD supports many presentational features of HTML,
including the deprecated elements and attributes. It is best used for older documents
that contain deprecated features.
• frameset : The frameset DTD is used for documents containing frames, and also sup-
ports deprecated elements and attributes (for a discussion of frames, see Appendix E).
• strict : The strict DTD does not allow any presentational features or deprecated HTML
elements and attributes, and does not support frames or inline frames. It is best used
for documents that must conform strictly to the latest standards.
If you need to validate the HTML or XHTML code found in older Web sites, you
should use the transitional DTD, which recognizes deprecated elements and attributes
such as the font element and the bgcolor attribute. If you need to support older brows-
ers in a framed Web site, you should use the frameset DTD. If you want to weed out any
use of deprecated features and you have no need to support frames, then you should use
the strict DTD.
All three DTDs require that the following elements be present in every valid XHTML
Although the html , head , and body elements are generally expected under HTML,
XHTML requires that every valid document include the title element as well. XML
parsers reject any XHTML document that omits the title element.
However, there are also elements that are allowed in one DTD but not in another. For
example, the following elements are not allowed under the strict DTD for XHTML 1.0:
But these elements are allowed in the transitional DTD, and you often will encounter
them in the code with older Web pages. The frameset DTD supports these elements as
well as the frame , frameset , and noframes elements. Therefore, the code
which uses the deprecated font element to format text, would be considered valid code
under the transitional and frameset DTDs but not under the strict DTD.
In addition to prohibiting the use of certain elements, the strict DTD also requires a par-
ticular document structure. For example, you cannot nest a block-level element within an
inline element. Figure 9-8 lists the prohibited child elements under the strict DTD.