HTML5: The DOCTYPE Declaration

This article is the first in a series of brief discussions about the proposed specifications for HTML 5. View the Working Draft for HTML 5 at the W3C.

The DOCTYPE declaration for HTML5 is very simple.
<!DOCTYPE html>

This DOCTYPE declaration can be used for documents that use either HTML and XHTML syntax. It is not case sensitive.

The proposal currently includes “legacy” DOCTYPES for software that expect a DOCTYPE to include either a PUBLIC or SYSTEM identifier, and is unable to omit them. That is,
<!DOCTYPE html SYSTEM "about:legacy-compat">

In this example, the about:legacy-compat must be in lowercase. It can be use with either single or double quotes.

The W3C states that no DOCTYPE is needed with XHTML, however, if you use one it must be in a form like the second example given.

The Opera browser, Safari, Firefox, and, to a more limited extent Internet Explorer, support some or most of the HTML5 specifications, including the simplified DOCTYPE declaration.

3 thoughts on “HTML5: The DOCTYPE Declaration”

  1. “The W3C states that no DOCTYPE is needed with XHTML, however, if you use one it must be in a form like the second example given.”

    No, it the short form is also allowed, or any other well-formed doctype for that matter.

    The legacy doctype is only recommended in text/html when using a tool that cannot emit the short doctype.

    The recommendation for XHTML5 is to omit the doctype.

Leave a Reply