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