Should the header and footer tags be inside the main tag

Viewed 42774

I'm using the main tag - should I put my header and footer tags inside the main tag or should they be separate?

Also, does the main tag need role="main"?

4 Answers

There are many ways to interpret semantics, but I would recommend to use header and footer as separated elements not within the main tag, but in between.

<header></header>
<main role="main"></main>
<footer></footer>

But I believe that your way of wanting to do it wouldn't be wrong either.

<main role="main">
<header></header>
<footer></footer>
</main>
Related