在 <section> 中使用 <header> 在语义上是正确的吗?

It is semantically correct to use <header> inside <section>?

我在网上找到的所有例子都是在<section>中使用<h1>,但与<header>元素的使用无关。

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

也许我误用了 <section> 元素,为了完整起见,这里是我的用例:

<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>

是的,在 section

中使用 header 在语义上是正确的

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.”

Source

您还可以查看 header W3 规格 here

header 是:

introductory content for its nearest ancestor sectioning content or sectioning root element.

section 是有效的分段内容,因此 header 在语义上是正确的 - 甚至鼓励 - 在这个位置。

直接引用自this HTML5 Doctor page, which actually quotes the HTML5 spec