HTML5 标题:HTML 验证器是否已过时?
HTML5 headings: is the HTML validator out of date?
W3C 在他们的 HTML5 section recommendation 中说
<body>
<h1>Let's call it a draw(ing surface)</h1>
<h2>Diving in</h2>
<h2>Simple shapes</h2>
<h2>Canvas coordinates</h2>
<h3>Canvas coordinates diagram</h3>
<h2>Paths</h2>
</body>
和
<body>
<h1>Let's call it a draw(ing surface)</h1>
<section>
<h1>Diving in</h1>
</section>
<section>
<h1>Simple shapes</h1>
</section>
<section>
<h1>Canvas coordinates</h1>
<section>
<h1>Canvas coordinates diagram</h1>
</section>
</section>
<section>
<h1>Paths</h1>
</section>
</body>
是"semantically equivalent"。
如果是这样,为什么 W3C HTML validator 关于后一个例子的警告?
关于第二个例子说的是:
Warning: 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).
验证器有误吗?
没有
Validator 警告现实世界中软件在野外的行为。许多软件包仍然没有为部分元素实现 HTML 5 大纲逻辑。
根据Wikipedia,语义等价表示两个数据元素具有相似的含义。
这两个示例最终很相似,渲染后看起来几乎相同。
但是,这确实意味着它们完全相同。
由于 SEO 原因,HTML5 当在部分标签之外使用 H1 然后在其他地方使用时,验证器将发出警告。
W3C 在他们的 HTML5 section recommendation 中说
<body>
<h1>Let's call it a draw(ing surface)</h1>
<h2>Diving in</h2>
<h2>Simple shapes</h2>
<h2>Canvas coordinates</h2>
<h3>Canvas coordinates diagram</h3>
<h2>Paths</h2>
</body>
和
<body>
<h1>Let's call it a draw(ing surface)</h1>
<section>
<h1>Diving in</h1>
</section>
<section>
<h1>Simple shapes</h1>
</section>
<section>
<h1>Canvas coordinates</h1>
<section>
<h1>Canvas coordinates diagram</h1>
</section>
</section>
<section>
<h1>Paths</h1>
</section>
</body>
是"semantically equivalent"。
如果是这样,为什么 W3C HTML validator 关于后一个例子的警告?
关于第二个例子说的是:
Warning: 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).
验证器有误吗?
没有
Validator 警告现实世界中软件在野外的行为。许多软件包仍然没有为部分元素实现 HTML 5 大纲逻辑。
根据Wikipedia,语义等价表示两个数据元素具有相似的含义。
这两个示例最终很相似,渲染后看起来几乎相同。
但是,这确实意味着它们完全相同。
由于 SEO 原因,HTML5 当在部分标签之外使用 H1 然后在其他地方使用时,验证器将发出警告。