skip to content →
infoSEO RULE · R29

Missing DOCTYPE: when browsers fall back to quirks mode

Without <!DOCTYPE html> as the first line of every HTML page, browsers fall back to "quirks mode" — a legacy rendering path with broken box-model, weird CSS inheritance, and unpredictable layouts. The fix is one line at the top of every template.

Without <!DOCTYPE html> as the first line of every HTML page, browsers fall back to "quirks mode" — a legacy rendering path with broken box-model, weird CSS inheritance, and unpredictable layouts. The fix is one line at the top of every template. The DOCTYPE declaration tells the browser which version of HTML to render. <!DOCTYPE html> declares HTML5 standards mode. Missing it triggers quirks mode for backward compatibility with sites from the 1990s.

Last updated·part of the 50-rule library

What it is

The DOCTYPE declaration tells the browser which version of HTML to render. <!DOCTYPE html> declares HTML5 standards mode. Missing it triggers quirks mode for backward compatibility with sites from the 1990s.

Why it matters

Quirks mode breaks modern CSS layouts in subtle ways (notably box-sizing inheritance), creating bugs that don't reproduce in dev. It's also a flag to SEO crawlers that the page may be using outdated rendering — a minor quality signal.

How to fix it

  1. Add <!DOCTYPE html> as the first line of every page. No whitespace before it. Case-insensitive. Required on every HTML response.
  2. Audit your CMS templates. Some legacy themes ship without it. Update the base template, not individual pages.
  3. Verify in DevTools. document.compatMode should return "CSS1Compat" (standards mode), not "BackCompat" (quirks mode).

Authoritative sources