Right or wrong in this case does not exist. There is recommended according to the specifications of HTML5
.
In the HTML4
by the fact of all semantic sections with the tag <div>
are part of the document structure, there are no ways to have sections containing information related not to the document itself, but to the site in general, such as logos, menus, content tables, copyright or legal notices. For that purpose, the HTML5
introduces three new elements:
<nav>
for link collections (such as a table of contents)
<footer>
and <header>
for information related to the website.
Realize that <footer>
and <header>
are not section contents like the <section>
, instead, they exist to delimit semantically parts of a section.
Returning now to your universe, the tag Nav is commonly used to create menus as it represents a set of links. So yes you do well to use it in your menu.
How to put it inside the tag header, is entirely up to you, as the menu somehow represents the structure of your site, and fits the recommended content for that tag "information related to the website".
Finally, on the use Section or instead of div, this can be a good practice, if the div
in question represents a section of your website. 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 the HTML5
tag section
.
In fact, I believe what he’s trying to say is
semantica
– Rafael Augusto
So it’s hard to answer without knowing what he’s really doing and what he’s using. I have page structures q created, where I use the header only for the logo and little information, and the Nav inside other Divs, or vice versa. It all depends even on the result q he wants to display on the screen and the organization of the codes with or without frameworks. At least that’s how I see it.
– Fernando VR
In fact, semantics does have a structure to follow https://www.w3schools.com/html/html5_semantic_elements.asp
– Rafael Augusto