Semantic Nav

In my current project I have a header will be used to navigate to different pages on the website. I am currently using a nav element to surround it like this:
<header>
<nav class="nav">
<div class="header"> ...
</div>
</nav>
</header>
<header>
<nav class="nav">
<div class="header"> ...
</div>
</nav>
</header>
At the moment I want to make a sidebar that is also used for navigation, but the navigation will be page specific, synonymous to a page of contents to navigate to different sections of a page. Should I wrap this sidebar in a nav as well or is it unnecessary because it's not the navigation for the website just the page?
2 Replies
13eck
13eck16mo ago
The <nav> HTML element represents a section of a page whose purpose is to provide navigation links, either within the current document or to other documents. Common examples of navigation sections are menus, tables of contents, and indexes.
–First sentence of the MDN description ToC is one of the specific things mentioned so yes, you should wrap the ToC in a nav element.
Solo Incrementing
Solo IncrementingOP16mo ago
very well, thanks for the clarification
Want results from more Discord servers?
Add your server