HTML and CSS Reference
3.6. HTML/XHTML Document Elements
Every HTML document should conform to the HTML SGML DTD, the form-
al Document Type Definition that defines the HTML standard. The DTD
defines the tags and syntax that are used to create an HTML document.
You can inform the browser which DTD your document complies with by
placing a special Standard Generalized Markup Language (SGML) com-
mand in the first line of the document:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
This cryptic message indicates that your document is intended to be com-
pliant with the HTML 4.01 final DTD defined by the World Wide Web Con-
sortium (W3C). Other versions of the DTD define more restricted ver-
sions of the HTML standard, and not all browsers support all versions of
the HTML DTD. In fact, specifying any other <!DOCTYPE> may cause the
browser to misinterpret your document when displaying it for the user.
It's also unclear what <!DOCTYPE> to use if you include nonstandard, albeit
popular extensions in the HTML documenteven for the deprecated HTML
3.0 standard, for which a DTD was never released.
HTML developers are increasingly including an appropriate SGML
DOCTYPE command as a prefix in their HTML documents. Because of
the confusion of versions and standards, if you do choose to include a
DOCTYPE in your HTML document, choose the appropriate one to ensure
that your document is rendered correctly.
For XHTML authors, we do strongly recommend that you include the
proper DOCTYPE statement in your XHTML documents, in conformance
the XML and XHTML standards.