gpt4 book ai didi

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

转载 作者:技术小花猫 更新时间:2023-10-29 12:20:22 28 4
gpt4 key购买 nike

我正在通过 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/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com