tags:

views:

257

answers:

7

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

+6  A: 

If the order of your menu is semantically important, and logical that tags comes after questions, then users and badges, then you should use ol, instead of an unordered list.

erenon
+3  A: 

Because semantically ul makes more sense if you don't care about the order of menu items.

If you need items to be somehow numbered or when the order has meaning, then we use ol.

If you're not interested in semantic markup but only in appearance, you can use either. Or even neither, use divs and spans and anything else to achieve the needed appearance.

Developer Art
A: 

well, maybe you always do it, but "we" doesn't mean anything here.

It depends if your list is ORDERED or UNORDERED. That's all.

Soufiane Hassou
+2  A: 

why do we use <strong> when we can use <em>? (they look differently by default, but that's another story. ol and ul also have different bullets/numbers by default)

navigation items are usually without any specific order, and thus an unorderd list <ul> is used instead of an ordered one <ol>

knittl
`<emph>`? Never heard of. And I’ve never used `<strong>` in place of `<em>`, nor have I ever seen anybody confuse these tags before.
Konrad Rudolph
confused html and latex …
knittl
<em> and <strong> are more about how to read text than how it displays, although yes they display roughly equivalent to <i> and <b> (which have no semantic meaning, and are therefore presentational and should be abstracted from the markup)
adam
+1  A: 

It's not a strict rule - if the navigation imposes order (e.g. registration steps), you can safely use an ol.

Alexander Gyoshev
+2  A: 

I think this is a classic example of why you should separate style from content. As Developer Art, if you don't care about semantic markup, then you can use either one or the other or something completely different at all.

<ul> and <ol> will be rendered differently as a default, with ordered lists numbered (or with letters) indicating the order and unordered lists with bullets or something similar. However, since I assume that about every web page uses styling, this doesn't necessarily matter.

I'd use ordered lists when the order is actually important for the content. Table of contents, enumerations, or any lists where the order is important for the content represented are examples. For most everything else I use unordered lists. (So, you could say that I always use unordered lists unless I have a good reason to use an ordered list.)

Though navigation items do have an order, this is more a visual thing of how navigation is represented and thus can be most easily achieved by using a simple unordered list and appropriate styling. I do not think that navigation items do have an order based on the content. I would argue that although the order is also important for navigation, it's not that important content-wise.

After all, it's a matter of how you see the content and shouldn't make that much difference when it comes to the actual implementation.

Anne Schuessler
+5  A: 

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>
Paul D. Waite