页面缺少 HTML 文档类型,因此触发了 Quirks 模式
Published on • Updated on
Translated to: English, Español, Português, 한국어, Pусский, 日本語
指定文档类型可防止浏览器切换到 Quirks 模式,从而导致页面以意外方式呈现。
Lighthouse 文档类型审核为何失败
没有 <!DOCTYPE html>
声明的 Lighthouse 标记页面:
![Lighthouse 审核显示缺少文档类型](https://wd.imgix.net/image/tcFciHGuF3MxnTr1y5ue01OGLBn2/l6IEjHdtgCa45QimENjb.png?auto=format)
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 页面。
资源
Updated on • 改进文章