Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5: using header or footer tag twice?

quick question: 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?

like image 924
matt Avatar asked Jan 29 '11 14:01

matt


People also ask

Can we use header tag multiple times?

Yes you can use multiple header elements in your documents, by virtue of the w3c documentation: 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.

Can we have 2 footers in HTML?

You can use multiple <footer> and <header> elements in one page. You nest footers inside other elements to contain footer information for that section of the page. Nested headers represent introductory content for a section of the page.

Can you have multiple footer tags?

Yes. Both <header> and <footer> tags are made to fulfill their respective purposes in relation to their parent “section”. So not only can you use both header and footer elements on a page in HTML5, but you can also use both in every <article> or <section>.

Can a Web page contain multiple header /< footer elements?

Yes, both <header> and <footer> can be added multiple times in a webpage. Both of these tags are designed to serve a crucial purpose in relation to their parent section.


2 Answers

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

like image 100
linusthe3rd Avatar answered Oct 01 '22 02:10

linusthe3rd


Yes you can use multiple header elements in your documents, by virtue of the w3c documentation:

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.

However ensure that it is semantically correct.

like image 30
Marcus Whybrow Avatar answered Oct 01 '22 04:10

Marcus Whybrow