Skip to content
uencoder

HTML Doctype

The HTML doctype declaration <!DOCTYPE html> tells the browser the document type and version and triggers standards-mode rendering.

Purpose

To ensure the browser renders the page in standards mode (not quirks mode); it is the required first line of an HTML document.

Mechanism

HTML5: <!DOCTYPE html> (short). HTML 4.01/XHTML 1.0: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "url"> (referencing a DTD). Modern documents need only the short HTML5 form.

Use cases

  • Standards mode for HTML documents
  • XHTML strict mode
  • Browser compatibility

Related tools

References