页面缺少 HTML 文档类型,因此触发了 Quirks 模式

Published on Updated on

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

指定文档类型可防止浏览器切换到 Quirks 模式,从而导致页面以意外方式呈现

Lighthouse 文档类型审核为何失败

没有 <!DOCTYPE html> 声明的 Lighthouse 标记页面:

Lighthouse 审核显示缺少文档类型

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

如何添加文档类型声明

<!DOCTYPE html> 声明添加到 HTML 文档的顶部:

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

有关更多信息,请参阅 MDN 的 Doctype 页面。

资源

Last updated: Improve article

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.