Page lacks the HTML doctype, thus triggering quirks mode

Published on Updated on

Translated to: Español, Português, 한국어, 中文, Pусский, 日本語

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

Updated on Improve article

This site uses cookies to deliver and enhance the quality of its services and to analyze traffic. If you agree, cookies are also used to serve advertising and to personalize the content and advertisements that you see. Learn more about our use of cookies.