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](https://developer.chrome.google.cn/static/docs/lighthouse/best-practices/doctype/image/lighthouse-audit-showing-156167946cd09.png?authuser=7)
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.