treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Is it appropriate to use [nav] multiple times?

  • On a website with multiple menus, sub-menues, etc, is it appropriate to use multiple nav tags, or just use it once and for the others use unordered lists?

    Thanks

  • Per HTML5Doctor.com

    NAV:

    Represents navigation for a document. The nav element is a section containing links to other documents or to parts within the current document.

    Not all groups of links on a page need to be in a nav element — only groups of primary navigation links. In particular, it is common for footers to have a list of links to various key parts of a site, but the footer element is more appropriate in such cases._

  • Nav and footer tags can be used multiple times on a page in HTML5, albeit it really doesn't make much sense to use them multiple times. The same is true of header tags so long as they're wrapped in a section or article tag.

  • Nav can be used multiple times on a page in HTML5.

    CAN...yes

    SHOULD...probably not.

    I've always worked in the basis that the NAV tag is only for the primary page/site navigations.

    If my main (header) navigation area is used for the [nav] then any other menus can be in divs.

  • albeit it really doesn't make much sense to use them multiple times.

  • according to the spec it's not inappropriate to use the nav tag multiple times on a page.

    i tend to only use it for the primary site navigation, not inter-page navigation, but that's just a personal preference.

  • Understood. Thank you

    Here's a follow up question, wrapping an unordered list with the tag, or not use an unordered list at all? Or use where appropriate?

  • Any of the new HTML5 elements can be used multiple times, apart from the new MAIN element, which can only be used once.

    I would say main navigation, footer navigation and breadcrumb would be good use cases for the NAV element.

    @barkins - I would personally wrap the UL in a NAV if navigation. So NAV>UL>LI