使用< header>在语义上是正确的。里面< section>? [英] It is semantically correct to use <header> inside <section>?

查看:155
本文介绍了使用< header>在语义上是正确的。里面< section>?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在互联网上找到的所有示例都指的是在< section> 中使用< h1> ,但没有与使用< header> 元素有关。

All examples I found on internet refers to using <h1> inside <section>, but nothing related to the use of <header> element.

这是有效的HTML5,但是语义呢?

It's valid HTML5, but what about semantics?

也许我在滥用< section> 元素,这里的完整性是我的用例:

Maybe I'm misusing the <section> element, for the completeness here is my use case:

<main role="main">
  <header>page header</header>
  <section id="cookiesPolicy>
    <header>
      <h1>Cookies Policiy</h1>
    </header>
    <div>Bla bla bla bla bla bla bla</div>   
  </section>    
  <footer>page footer</footer>
</main>




推荐答案

是否在语义上正确使用标题区内

Yes it is semantically correct to use header inside section


标题 - 标题元素与
标题的一般接受用法之间存在重要差异c $ c>(或标头)。页面中通常只有
只有一个标题或'标头'。在HTML5中你可以有多少
如您所愿。规范将其定义为一组介绍性或
导航辅助工具。您可以在任何部分使用标头 在您的网站上。
事实上,您可能应该这样做在大多数
部分中使用标题。该规范将部分元素描述为主题
内容分组,通常带有标题。

header – There is a crucial difference between the header element and the general accepted usage of header (or masthead). There’s usually only one header or ‘masthead’ in a page. In HTML5 you can have as many as you want. The spec defines it as "a group of introductory or navigational aids". You can use a header in any section on your site. In fact, you probably should use a header within most of your sections. The spec describes the section element as "a thematic grouping of content, typically with a heading."

来源

您还可以查看标题 W3规范此处

You can also check header W3 specs here

这篇关于使用&lt; header&gt;在语义上是正确的。里面&lt; section&gt;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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