What is the most appropriate content to put in the header or the nav?

2

I'm creating a page that has the logo and its name in header , and a menu with links for other pages using lists in nav , but I'm not putting nav inside header , I put them all inside a div with a class menu, is it okay to do this? or would it be better to put nav within header , and instead of using div , use section ?

    
asked by anonymous 03.10.2017 / 19:25

2 answers

2

Right or wrong in this case does not exist. recommended by HTML5 specifications.

No HTML4 because all semantic sections with the <div> tag are part of the document structure, there are no ways to have sections that contain information related not to the document itself, but to the site as a whole, as logos, menus, tables of contents, copyright or legal notices. For this purpose, HTML5 introduces three new elements:

  • <nav> for link collections (such as a table of contents)
  • <footer> and <header> for site-related information.

Note that <footer> and <header> are not section contents like <section> , instead, they exist to semantically delimit parts of a section.

Returning now to your universe, the nav tag is commonly used to create menus as it represents a set of links. So yes you do well in using it in your menu. Home As for placing it inside the header tag, it is entirely up to you, as the menu represents in a way the structure of your site, and falls within the recommended content for this tag " information related to the site ". Finally, using section or div might be a good practice if the div in question represents a section of your site. Example:

<div class="corpo-da-pagina">
    <!-- Todo o conteúdo da sua página -->
</div>

In the above case it would be recommended according to the specifications of HTML5 to use a section tag.

    
03.10.2017 / 20:16
1

Are you using any framework ?? type boostrap or some other ?? If you have, you have to check in their documentation, as each framework follows a hierarchy along with CSS q if you do not follow can be messed up on your screen.

If you are not using anything, you are creating everything from 0, there is no wrong way to do it, it can be in div as it can be in specific tags like header , this will only be a matter of organizing the your code. But what will make the difference is the way you will treat everything in your style.

    
03.10.2017 / 19:58