Skip to content
学习 衡量 博客 Case studies 关于
本页内容
  • Lighthouse 文档类型审核为何失败
  • 资源

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

May 2, 2019 — 更新日期 Aug 28, 2019
Available in: Español, 日本語, 한국어, Português, Русский, English
Appears in: 最佳做法审核
本页内容
  • Lighthouse 文档类型审核为何失败
  • 资源

指定文档类型可防止浏览器切换到 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 页面。

资源 #

  • 页面的源代码缺少 HTML 文档类型,因此触发了 Quirks 模式审核
  • Doctype
  • Quirks 模式和标准模式
Last updated: Aug 28, 2019 — Improve article
Return to all articles
分享
订阅

Contribute

  • 提交错误
  • 查看源代码

相关内容

  • developer.chrome.com
  • Chrome 动态
  • 网站开发基础
  • 案例研究
  • 播客
  • 节目

连接

  • Twitter
  • YouTube
  • Google Developers
  • Chrome
  • Firebase
  • Google Cloud Platform
  • 所有产品
  • 条款和隐私权
  • 社区准则

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.