html - W3C 验证说文章中的 h1 无效

标签 html w3c-validation

我正在通过 W3C 验证服务运行我的网站。我收到以下 HTML 的错误消息:

<section class="about">
  <article>
    <header>
    <h1>Mission</h1>
    </header>
    <div class="content">
      <p>bla bla bla</p>
    </div>
    <aside>
      <img src='/images/logo-hse-250x250.png' />
    </aside>
  </article>
</section>

W3C 验证错误是:

Consider using the h1 element as a top-level heading only (all h1 elements are treated as top-level headings by many screen readers and other tools).

<h1>Mission</h1>

我认为对于 HTML5,允许在一个页面上使用多个 h1 标签。 h1 标签可以在 article 元素中使用。

有谁知道为什么 W3C 不验证此 HTML?

最佳答案

在那里使用h1是有效的。

W3C Markup Validator确实报告警告,而不是错误。如果愿意,您可以忽略警告。

HTML5 spec "encourages" authors to use "headings of the appropriate rank"而不是到处都是 h1。但鼓励不是规范要求。

关于html - W3C 验证说文章中的 h1 无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25996074/

相关文章:

wordpress - 阻止文本在图像下方环绕

php - 将表值传递到另一个页面进行 SQL 查询

html - 如何使YouTube W3C的HTML嵌入代码兼容?

HTML 检查 - 在 href 中使用 tel 时网站无效

html - 如何解决类似 fb 框的 HTML5 验证错误?

html - 在一个div中垂直平均划分段落

javascript - 如何将搜索添加到页脚中 DataTable 的某些单独列?

html - 为什么 `text-align:justify` 只对图像的第一行有效?

html - 元素按钮不得作为 a 元素的后代出现

javascript - HTML & JavaScript 验证问题 : "Element script is missing required attribute src"