Skip to content

Doctype and the basics of a valid document

Best practices1 min readFixes check doctype

A missing doctype throws browsers into quirks mode with 1990s layout rules. Start every page with <!doctype html>.

Step by step, with screenshots: HTML validation errors: which ones matter and which are noise →

Check your own site

Runs this check and the other 186, free, in about 45 seconds.

What a passing site looks like

  • Doctype is presentwarning · −1 ptseffort S

Doctype is missing

Why it matters. Without <!doctype html>, browsers render in quirks mode and layouts can differ between browsers.

How to fix it.
  1. Put <!doctype html> as the very first line of the document.

Filed under Best practices. Copy is generated from the same catalogue that scores every report, so what you read here is what the report says.