Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Why do we always use <ul> to make navigation why not <ol>? While we can use both technically.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
704 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...