html markup for navigation

There’s been a lot of griping today about the use of an unordered list for a navigation menu (from @calevans among others). Although it is a generally accepted practice with the argument that a navigation menu is an unordered list of links, it’s not too difficult to find an alternative that is just as efficient is it? What’s the most basic code we could use as an alternative?

In html5 you could use the following: –

<a title="First link additional text" href="#">Link 1</a>
<a title="Second link additional text" href="#">Link 2</a>
<a title="Third link additional text" href="#">Link 3</a>

with css to sort out positioning and look.

For some specific layouts you may want to specify a :first-child pseudo class or a class="last" on a link.

For HTML4 strict just substitute a <div class="menu"> for <nav>.

So, not as complicated as I once thought!

One thought on “html markup for navigation”

  1. Hi Tess!

    Thanks for making it very simple. My problem is only with designers (and I’ve worked with more than one) that alter the default behavior of the UL instead of putting it in the DIV. If you are doing it for your own site and you know there will never be a need for a list of items, hey go for it. However, if you’ve got to work with others (especially hard-headed programmers) then wrapping it in a DIV is the way to go.


Comments are closed.