I see people using a ul tag all the time for navigation. What is the difference between an ul tag and a ol tag. I know that the ol tag gives you a numbered list. So does it just come down to preference or is there a big difference in the two?
the main difference is a semantic one. An ordered list <ol> is for a list that you want to be or believe should be in a specific order - steps in a tutorial perhaps? An unordered list <ul> is one that isn't necessarily required to be a particular order - a navigation system etc.
By default, a <ul> (unordered list) gives you a list of bullet points; an <ol> (ordered list) gives you a numbered list. But for a navigation menu, there's no difference because you usually specify "list-style-type: none;" which gets rid of the bullets/numbers anyway.
hmmmm, you seem to have missed my point - that there IS a difference. The type of list, ol or ul, pertains to the function of the specified list - its meaning. You cannot simply think of these different list-types in purely visual terms. Whatever is tweaked using CSS will make no difference to a screen reader, or a google bot etc, so you should take care to place the right kind of content in its appropriate tag.
Wow. That's some good feedback on this question. As I learn more about web design I am learning that it goes deeper than one would think. When you start planning your website for screen readers you know you are putting some detail into the site. Thanks for the responses. It was helpfull
Maybe an ordered list could be useful if correspondent accesskeys were set for the navigation items... but in "usual" scenarios, I'd stick with box's reply. :)
Maybe an ordered list could be useful if correspondent accesskeys were set for the navigation items... but in "usual" scenarios, I'd stick with box's reply. :)
That's the exact reason why I'd use ol for my navigation. Then again you'd need to use the same accesskeys when modifying the menu. So if you'd add another element, it would need to be the last (bottom of list). Then it wouldn't lose accesskey consistency. For regular users, the list items could be rearranged by CSS.
Absolutely, but it could be linear too. For instance, if you'd use a list-navigation on a check out-process on a webshop. Or a user registration pages that's really long and should be split up.
Thanks for the responses. It was helpfull
That's the exact reason why I'd use ol for my navigation. Then again you'd need to use the same accesskeys when modifying the menu. So if you'd add another element, it would need to be the last (bottom of list). Then it wouldn't lose accesskey consistency. For regular users, the list items could be rearranged by CSS.