This check finds an HTML document without a valid doctype before the root element.
Why this matters
Without the doctype, browsers may enter quirks mode and emulate legacy layout behavior. CSS dimensions, table behavior, and other rendering details can then differ from standards mode and vary unexpectedly across browsers.
How to fix it
- Put
<!doctype html>as the first meaningful line of every HTML document. - Add it to the shared document or layout template so every route receives the same declaration.
- Do not place comments, XML declarations, or other output before it.
- Check server-generated error pages and standalone embeds as well as primary templates.
When the finding appears across many URLs, fix the shared component or layout that produces it instead of patching generated HTML page by page. Recheck representative templates and responsive states after deployment so the correction does not create a regression elsewhere.
How to verify the fix
Inspect the raw response and confirm the declaration appears before <html>. In the browser console, document.compatMode should report CSS1Compat rather than BackCompat.
Keep before-and-after evidence for the affected URL, original output, correction, and verification method. If markup changes after load, test consent states, localization, responsive variants, and client-side navigation because the initial HTML and rendered DOM can differ.