2.2. Document Type Tag

The DOCTYPE tag is one of the most overlooked tags in HTML. Strictly speaking, it isn't an HTML tag but a generic document identifier used to tell validation tools and clients what format and conventions the document content follows. A typical document type tag resembles the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
   "http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">

This tag specifies the following information:

  • The document's top tag level is HTML (html).

  • The document adheres to the formal public identifier (FPI) "W3C XHTML Basic 1.0 English" standards (PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN").

  • The full DTD can be found at the URI http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd.

The DTD specifies each valid element that can be contained in the document, including the attributes for the element and types of values each can contain. For example, the XHTML 1.0 Strict DTD contains the following section for the anchor tag (<a>):

<!--================== The Anchor Element ================================-->

<!-- content is %Inline; except that anchors shouldn't be nested -->

<!ELEMENT a %a.content;>
<!ATTLIST a
  %attrs;
  %focus;
  charset     %Charset;      #IMPLIED
  type        %ContentType;  #IMPLIED
  name        NMTOKEN        #IMPLIED
  href        %URI;          #IMPLIED
  hreflang    %LanguageCode; #IMPLIED
  rel         %LinkTypes;    #IMPLIED
  rev         %LinkTypes;    #IMPLIED
  shape       %Shape;        "rect"
  coords      %Coords;       #IMPLIED
  >

This section specifies the relationship the <a> tag has to the document (in-line) ...

Get Web Standards Programmer's Reference: HTML, CSS, JavaScript®, Perl, Python®, and PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.