Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other nav tag – proper usage

  • This topic is empty.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #38276

    Me and my co-worker argue over the proper use of the < nav > tag. When using the < nav > tag do you put an < ul > inside of it or just a bunch of < a > tags? I typically still use the < ul > inside the < nav > just because it is what I am used to doing and it is still a list of links. What do you guys think?

    #103650
    Senff
    Participant

    Whatever you use for your site navigation (be it

      s and

    • s, or just images, or just a number of links) that’s what

      is for.

      You’re not required to put a

        list in your

        , but it’s a common thing to do nowadays, cause it’s (usually) a list of links.

      #103706
      Paulie_D
      Member

      Also, just because it’s a list of links doesn’t mean you have to use a nav tag.

      In general, and I think this was the spec, the nav tag is to be used to…oh heck, I’ll just cut and paste.

      The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links. Not all groups of links on a page need to be in a nav element only sections that consist of major navigation blocks are appropriate for the nav element. 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, and no nav element is necessary for those links.

      #107329
      aydoubleyou
      Participant

      Both methods are acceptable as far as I know. It does irk me a bit to include a ul tag within the nav though just because it’s extra bloat in my markup .

      #108781
      frhetoric
      Member

      I agree that still putting an

        tag keeps it tidy, semantics-wise. However, my pickle is how do I properly call it in the css. I can’t seem to find a good practice to id it. Newbie, btw. Be gentle.

        #108783
        frhetoric
        Member

        your pre tag confuses me.

        #108804
        Vermaas
        Participant

        I always use this approach:



        Just to make sure it will also work in older versions of IE/in IE. Seems to me perfectly semantic.

        #108805
        Paulie_D
        Member

        @Vermaas That is true if you are using lists but


        is equally valid if you are not.

        #108806
        Vermaas
        Participant

        @Paulie_D And does it also work in IE7-IE9?

        #108807
        Paulie_D
        Member

        It works in IE9 without any help (I think)

        For IE8 and below, you would need to use the HTML5 shiv….but you’d be including that as a matter of course anyway for HTML5 elements.

        #108808
        Paulie_D
        Member

        Just remember that the above is NOT an HTML list…it’s just a bunch of links grouped together…it won’t behave like a ‘true’ list.

        #123211
        andymaray
        Participant

        @Paulie_D

        What about the sub menu(dropdown)? is it possible to create with just nav, a tags

        #123212
        Paulie_D
        Member

        Nope….although I suppose you could fake it.

        Proper Submenus need to be list children of list items

        Viewing 13 posts - 1 through 13 (of 13 total)
        • The forum ‘Other’ is closed to new topics and replies.