Can I use the header / footer tags inside the main / section tag?

3

I would like to know if you can, within the element <main> , or <section> , put the tags <header> and <footer> .

For example:

<section>
   <header>topo da section</header>
      conteudo da section
   <footer>rodape da section</footer>
</section>

or

<main>
  <header>topo da section</header>
    conteudo da tag main
  <footer>rodape da section</footer>
</main>

Is this correct?

    
asked by anonymous 29.08.2018 / 03:00

2 answers

6

Yes, it is allowed.

According to the W3C specification, both the <section> element and the <main> allow content as elements flow content , which include the <header> and <footer> elements.

For example, posting to a blog:

<main>
    <header>
        <h1>Minha espetacular publicação<h1>
    </header>
    <section>
        <p>Ok, não é tão espetacular assim</p>
    </section>
    <footer>
        <time datetime="2018-08-28 20:00">Publicado em 2018-08-28 20:00</time>
    </footer>
</main>
    
29.08.2018 / 03:14
2

Come on, a section is as if it belonged to a person's trunk, the head header and footer were the feet, if you put the footer inside a section the feet would stay in the stomach but still it would be possible to use it only it would look strange (kkk). When it comes to main, it can not be 'child' of these elements.

    
29.08.2018 / 04:21