htmlheadersemantics

Using <header> or <footer> tag twice?


Is it actually allowed to use the header tag twice? e.g. I have two important head-sections in my header.php where both could have header tag.


Solution

  • Yes, but with a catch. The W3 documents state that the tags represent the header and footer areas of their nearest ancestor section. I would recommend having as many as your want, but only 1 of each for each "section" of your page, i.e. body, section etc.

    From W3

    A header element is intended to usually contain the section's heading (an h1–h6 element or an hgroup element), but this is not required. The header element can also be used to wrap a section's table of contents, a search form, or any relevant logos.

    =========================

    The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.

    Here are links to their respective standard documentation: header and footer