Why do we always use <ul>
to make navigation why not <ol>
? While we can use both technically.
Why do we always use <ul>
to make navigation why not <ol>
? While we can use both technically.
There isn’t much practical difference between the two.
Using <ol>
suggests that it’s important the list remain in the same order. For most navigation on the web, the order of the navigation items doesn’t matter.
An exception would be navigation within a process, e.g. if you’re taking the user through a 3-step purchase process, and are giving them navigation to move to any step. An ordered list would be appropriate there, as the steps come one after the other, e.g.
<ol>
<li>Payment details</li>
<li>Delivery address</li>
<li>Summary</li>
</ol>
Note that in HTML5, you can and should wrap any major navigation block, whether it uses <ul>
, <ol>
or something else, in the <nav>
element.