Reputation: 626
I've almost never seen it done any other way, however it would seem more logical to use a <nav>
along with some <button>
One benefit is that the label of a button is not selectable, which makes for a cleaner navigation. Code-wise, <nav>
and <button>
make sense immediately, whereas it requires a bit of interpretation to determine that a particular <ul>
has a particular role.
I suppose that it's an old habit predating HTML5 or even style sheets, but I don't see any reason to carry it on. Am I missing something ?
Upvotes: 0
Views: 21
Reputation: 944054
A typical navigation menu is made up of links (so <a>
fits better than <button>
which would submit a form), which are in a list which isn't designed to be followed in sequence (so <ul>
is appropriate).
<nav>
is a new feature in HTML 5, which can supplement this. The example use given on MDN shows a <nav>
containing a <ul>
.
Upvotes: 1