Grow your CSS skills. Land your dream job.

Is it appropriate to use [nav] multiple times?

  • # March 14, 2013 at 12:51 pm

    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

    # March 14, 2013 at 12:55 pm

    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._

    # March 14, 2013 at 1:17 pm

    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.

    # March 14, 2013 at 1:20 pm

    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.

    # March 14, 2013 at 1:43 pm

    > albeit it really doesn’t make much sense to use them multiple times.

    # March 14, 2013 at 1:55 pm

    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.

    # March 14, 2013 at 2:46 pm

    Understood. Thank you

    Here’s a follow up question, wrapping an unordered list with the

    # March 14, 2013 at 3:49 pm

    For main [navigation I always use](http://codepen.io/anon/pen/noxDb) `ul`.

    # March 14, 2013 at 4:04 pm

    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

    # March 15, 2013 at 5:22 am

    Thanks

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".