HTML provides three semantic list types: unordered lists for items without a meaningful sequence, ordered lists for steps or rankings, and description lists for terms paired with explanations. Choosing the correct element improves structure, accessibility and maintainability.
Choose the right HTML list
- Use
<ul>when changing the item order would not change the meaning. - Use
<ol>when sequence or ranking matters. - Use
<dl>for name-value groups such as terms and definitions or metadata.
Unordered lists
<ul>
<li>Apples</li>
<li>Oranges</li>
<li>Pears</li>
</ul>
Result:
- Apples
- Oranges
- Pears
Ordered lists
<ol>
<li>Fill the pot with water</li>
<li>Bring the water to the boil</li>
<li>Add the rice</li>
<li>Cook for 15 minutes</li>
</ol>
Result:
- Fill the pot with water
- Bring the water to the boil
- Add the rice
- Cook for 15 minutes
Start from another number
Use the start attribute on <ol> when numbering must begin with a value other than 1.
<ol start="5">
<li>Review the brief</li>
<li>Create the first draft</li>
</ol>
- Review the brief
- Create the first draft
Reverse the numbering
The Boolean reversed attribute displays an ordered list in descending order.
<ol reversed>
<li>Gold</li>
<li>Silver</li>
<li>Bronze</li>
</ol>
- Gold
- Silver
- Bronze
Change an individual item value
Use the integer value attribute on an <li> inside an ordered list. Numbering continues from that value.
<ol>
<li>First item</li>
<li value="5">Fifth item</li>
<li>Sixth item</li>
</ol>
- First item
- Fifth item
- Sixth item
Description lists
A description list groups each term in <dt> with its description in <dd>.
<dl>
<dt>CTR</dt>
<dd>Clicks divided by impressions.</dd>
<dt>CPC</dt>
<dd>The cost paid for each click.</dd>
</dl>
- CTR
- Clicks divided by impressions.
- CPC
- The cost paid for each click.
Nested lists
Place the nested list inside the parent <li> so the relationship remains valid and clear.
<ol>
<li>Cafe</li>
<li>Shop
<ul>
<li>Item A</li>
<li>Item B</li>
</ul>
</li>
</ol>
Change list markers with CSS
Use the CSS list-style-type property for visual marker styles. Keep the semantic list element that matches the content.
ul { list-style-type: square; }
ol { list-style-type: upper-roman; }
For a broader learning path, read why and how to learn HTML and CSS.