HTML <ul> <ol> and <li> Elements
These three elements define and display items in the form of a list. The <ul> and <ol> elements define the
type of list and <li> elements contain each separate item in the list.
Using <ul> will give you an unordered list with simple bullet points, and <ol> shows an ordered list with numbered list items.
Example code:
Unordered
<ul>
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
<li>Fourth Item</li>
</ul>
Ordered
<ol>
<li>First Item</li>
<li>Second Item</li>
<li>Third Item</li>
<li>Fourth Item</li>
</ol>
Which displays:
Unordered list result:
- First Item
- Second Item
- Third Item
- Fourth Item
- First Item
- Second Item
- Third Item
- Fourth Item
Which list to use - ordered or unordered.
The recommendation is to use an ordered list when you are showing a sequence of logical steps which must be followed one after the other such as recipe instructions or assembly details, in other cases an unordered list will suffice.
<ul> <ol> and <li> Attributes
- CORE AND LANGUAGE ATTRIBUTES - class, id, title, style, dir, lang
- MOUSE AND KEYBOARD EVENT ATTRIBUTES - onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmouseout, onmousemove, onkeydown, onkeyup, onkeypress
