A quick question re: HTML5 nav, specifically that of sub navigation (from a semantic point of view).
I have <nav>
in the header for the main menu. Down the left of a standard page I have second level nav and down the right third level nav (no, I didn’t design the site). Is there anything I can do HTML5/ARIA wise to differentiate between the 3 menus? Or are they all simple <nav>
blocks?
I dont even think I need <aside>
in either left or right column as there isnt any additional info apart from these actual menus.
Any thoughts/advice would be much appreciated.
It is a semantic element. Common examples of the nav elements are menus, tables, contents, and indexes.
Semantic HTML elements are those that clearly describe their meaning in a human- and machine-readable way. Elements such as <header> , <footer> and <article> are all considered semantic because they accurately describe the purpose of the element and the type of content that is inside them.
HTML5 provides new semantic elements that allow authors to specifically define aspects of web documents, including <header> , <footer> , <section> , <article> , <figure> and <figcaption> .
This may be an old question, but there is a better answer now:
You can label each navigation section implicitly using headings, and explicitly use WAI-ARIA attributes:
<nav role="navigation" aria-labelledby="firstLabel">
<h2 span id="firstLabel" class="hidden">Main menu</h2>
<ul/>
</nav>
...
<nav role="navigation" aria-labelledby="secondLabel">
<h2 span id="secondLabel" class="hidden">Local pages</h2>
<ul/>
</nav>
For user-agents like screenreaders, they can report that as "Local pages, navigation" (although they vary in how it's reported).
Read more on a W3C wiki page on using labelledby.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With