HTML lists group related items
Web pages often show lists. HTML gives you two main list types. An ordered list uses numbers when the order matters. An unordered list uses bullets when the order does not matter.
Here is an unordered list of tools a web developer might use:
<ul>
<li>Computer</li>
<li>Keyboard</li>
<li>Browser</li>
</ul>
Each item goes inside an <li> tag, which stands for list item.
Ordered, unordered, and nested lists
Use <ol> for ordered lists and <ul> for unordered lists. Nest one list inside another by placing a new list inside an <li>.
<ol>
<li>Preheat the oven.</li>
<li>Mix the batter.
<ul>
<li>Flour</li>
<li>Sugar</li>
<li>Eggs</li>
</ul>
</li>
<li>Bake for 20 minutes.</li>
</ol>
Ordered lists are good for steps. Unordered lists are good for groups where order does not matter.
Build a list
Type items one per line. Choose ordered or unordered, then see the HTML and the rendered list.
Check yourself
Write the HTML for an ordered list of three things you did today.
Sample answer:<ol>
<li>Woke up</li>
<li>Ate breakfast</li>
<li>Brushed teeth</li>
</ol>
A list example
HTML has tags for ordered, unordered, and description lists. This example shows all three.
Quick quiz
1. Which tag makes a numbered list?
2. What does <li> stand for?
3. Which list uses bullets?
Keep learning
You can make lists in HTML. Try styling them with CSS next.