Skip to content
Learn Measure Blog Case studies About
On this page
  • How the Lighthouse doctype audit fails
  • How to add a doctype declaration
  • Resources

Page lacks the HTML doctype, thus triggering quirks mode

May 2, 2019 — Updated Aug 28, 2019
Available in: Español, 日本語, 한국어, Português, Русский, 中文, English
Appears in: Best Practices audits
On this page
  • How the Lighthouse doctype audit fails
  • How to add a doctype declaration
  • Resources

Specifying a doctype prevents the browser from switching to quirks mode, which can cause your page to render in unexpected ways.

How the Lighthouse doctype audit fails #

Lighthouse flags pages without the <!DOCTYPE html> declaration:

Lighthouse audit showing missing doctype
Each Best Practices audit is weighted equally in the Lighthouse Best Practices Score. Learn more in The Best Practices score.

How to add a doctype declaration #

Add the <!DOCTYPE html> declaration to the top of your HTML document:

<!DOCTYPE html>
<html lang="en">
…

See MDN's Doctype page for more information.

Resources #

  • Source code for Page lacks the HTML doctype, thus triggering quirks mode audit
  • Doctype
  • Quirks Mode and Standards Mode
Last updated: Aug 28, 2019 — Improve article
Return to all articles
Share
subscribe

Contribute

  • File a bug
  • View source

Related content

  • developer.chrome.com
  • Chrome updates
  • Web Fundamentals
  • Case studies
  • Podcasts
  • Shows

Connect

  • Twitter
  • YouTube
  • Google Developers
  • Chrome
  • Firebase
  • Google Cloud Platform
  • All products
  • Terms & Privacy
  • Community Guidelines

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies.