W3C验证说文章中的h1无效 [英] W3C validation says h1 in article is invalid

查看:204
本文介绍了W3C验证说文章中的h1无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过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验证错误是:


考虑仅使用 h1 元素作为顶级标题(所有 h1 元素均为被许多屏幕阅读器和其他工具视为顶级标题。)

 < h1> Mission< / h1> 


我想用HTML5,它被允许使用多个页面上的 h1 标记。并且 h1 标签可以在文章元素中使用。



<有没有人知道为什么W3C没有验证这个HTML?

解决方案

使用<$ c $是有效的c> h1 那里。



W3C标记验证器报告警告,而不是错误。如果您愿意,可以忽略警告。



HTML5规范鼓励作者在任何地方使用适当等级的标题而不是 h1 。但鼓励不是规范性要求。


I'm running my website through the W3C validation service. I'm getting an error message for the following 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>

The W3C validation error is:

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>

I thought with HTML5, it was allowed to use more than one h1 tag on a page. And that h1 tags could be used inside article elements.

Does anyone have a clue why W3C isn't validating this HTML?

解决方案

It is valid to use h1 there.

The W3C Markup Validator does report a warning, not an error. You can ignore warnings if you like to.

The HTML5 spec "encourages" authors to use "headings of the appropriate rank" instead of h1 everywhere. But an encouragement is not a normative requirement.

这篇关于W3C验证说文章中的h1无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆