Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In HTML5, can the <header> and <footer> tags appear outside of the <body> tag?

Tags:

html

tags

I'm currently using the above tags in this way (classic tag order):

<html>   <head>...</head>   <body>     <header>...</header>     <section>...</section>     <footer>...</footer>   </body> </html> 

Tag usage and specifications were very rigid in previous versions of HTML (4.x), while HTML5 doesn't really need <head> and even <body> tags.

So I would use the following structure, which IMHO is much more semantic than the previous one.

<html>   <header>...</header>     <!-- put header and footer outside the body tag -->   <body>     <section>...</section>     <section>...</section>     <section>...</section>   </body>   <footer>...</footer> </html> 

What do you think?

like image 998
Salaros Avatar asked Mar 30 '11 21:03

Salaros


People also ask

Does header and footer go inside body?

Since the footer is a visible piece of your site, it should go within the body.

Does the footer go outside the body HTML?

HTML5 <footer> Tag The <footer> tag in HTML is used to define a footer of HTML document. This section contains the footer information (author information, copyright information, carriers, etc). The footer tag is used within the body tag.

Does the header tag go inside the body tag HTML?

Because the header of a page is part of the body of the page, just as the footer. Think about this <body> as a human body: Head, middle of the body and the feet. A page has the same concept: Header (is the head), section (middle of the body), and footer (the feet).

Can header be inside body?

Note: You can have several <header> elements in one HTML document. However, <header> cannot be placed within a <footer>, <address> or another <header> element.


1 Answers

Well, the <head> tag has nothing to do with the <header> tag. In the head comes all the metadata and stuff, while the header is just a layout component.
And layout comes into body. So I disagree with you.

like image 137
Iulius Curt Avatar answered Sep 26 '22 02:09

Iulius Curt