Seems interchangable?
UL means "unordered list". OL means "ordered list".
UL gets you bullet points. OL gets you numbers.
Definitely not interchangable.
OL:
- List item 1
- List item 2
UL:
- List item 1
- List item 2
OL is ordered list, UL is unordered list
One is ordered list (OL), it is for things that have a defined and distinct order. There is a reason behind why they are organized.
The other (UL) is unordered list, which is just a collection of things in no specified order. Their organization is trivial.
I think it's a sematic issue, as the numbering/bullet points can be changed by CSS.
Ordered lists should be things like instructions, or any sequential information.
Unordered lists should be everything else.
With OL the order of the data is important and will be displayed (by default) while with UL not. Example:
<p>Tomorrow wi will</p>
<ol>
<li>Wake up</li>
<li>Have breakfast</li>
<li>Go to sleep</li>
</ol>
<p>During breakfast we will eat</p>
<ul>
<li>Butter</li>
<li>Spam</li>
<li>Sweet spam</li>
</ul>
Use OL when you're listing steps that need to be done in a certain order. Use UL when you're listing items in no particular order of importance.
Haha, so many answers!
When HTML first came out, there were OL and UL, which, as all of the other posters have said, meant Ordered List and Unordered List.
The difference was easy. OLs displayed... a number next to them. Or a roman numeral, or a letter! You could even control whether it used capitalized symbols or lowercase! Cool!
ULs gave you bullets. 3 types of bullets, even - discs (hollow circles), squares (filled squares), circles (filled circles.)
There was no CSS. Beyond these attributes, there wasn't really a way to customize the list formats (and margins and indententations and everything else.) So, this distinction was important.
Nowadays, its all CSS. In fact, the w3 people want you to use styles rather than the html "type" attribute that you used to use. So, using UL vs OL doesn't really matter, if you are one of them newfangled CSS users.
CSS lets you change the bullet type, or opt to use an image, or change the margins/styles/indentations, or not even display a bullet at all.
Edit again: This answer isn't really meant to address the semantic merits of UL vs OL. But technically (you know, at the bits and bytes) the above outlines the differences in behavior.
In math terms (hey, why not?), an <ol>
represents a sequence, whereas <ul>
represents a set. Rearranging the items in an ordered list changes the list's meaning. Rearranging them in an unordered list does not.
This is a good rule-of-thumb for which type of list to use. If changing the order of the items makes the list incorrect, you want to use <ol>
. If the order doesn't matter, use <ul>
.
ul means unorded list. It is for lists in whick it doesn't matter what order the list items are in.
ol means ordered list. It is for lists that are numbered or in some way show that they have a specific ordering.
By default ul gets you bullet pointed lists and ol numbered lists, although this can be edited in css.