The question came up recently about the appropriate use of lists in the new HTML5
But, before we go too far, let’s take a look at the definition of the
“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.”
So, we can all agree that the
nav element is for grouping navigation links. Not all links, however, are navigation links. You'll notice that the
nav element is for "major navigation blocks." Sitewide navigation, page specific navigation, etc.
Back to the point: what should go inside the
While putting the anchor tags as children of the
nav is definitely shorter, we quickly run into problems when we want to add a submenu. How do you mark it up now?
You can't do it without adding more markup that just doesn't make any sense. If we try to add a submenu to the
ul, it feels natural.
You now have navigation and sub-navigation with the benefit of inheriting CSS rules and JS if desired. Sure, the
ul version is longer, but it's consistent and has the added benefit of providing some extra hooks for styling the navigation elements.
The Bottom Line
If you think you might need sub-navigation at some point, go with the
ul version. It will allow you to easily add menus without having to rework your HTML & CSS.
If you want to throw caution to the wind and don't think you'll ever need sub-navigation (i.e. the sidebar for your blog perhaps?), go ahead and just drop those links right in the
Don't agree with me?
You can can always read what Ryan Buttrey has to say about it. Don't worry, I'll wait for you to come back for the right answer.