HTML provides a number of elements that allow related items (including links) to be grouped together. For example, a list element (either ordered or unordered) can be used to group the items in a navigation menu. Similarly, definition lists can be used to group terms and their definitions. Grouping related links help provide a more cohesive user experience and aids navigation.
Wherever a group of links are related, use an appropriate element to group them together in the code. For example, use an unordered list element (<ul>
) to group the links in a navigation menu (<li><a>
).
//Grouping links in a navigation menu using an unordered list
<ul role="navigation">
<li>Home</li>
<li>Contact</li>
<li><About Us</li>
<li><Directions</li>
</ul>