Canddi

HTML Lists: Beyond The Basics: Learn to Create HTML Lists

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:

  1. Fill the pot with water
  2. Bring the water to the boil
  3. Add the rice
  4. 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>
  1. Review the brief
  2. 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>
  1. Gold
  2. Silver
  3. 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>
  1. First item
  2. Fifth item
  3. 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.

Build this skill
Build better web foundations
Learn to structure accessible pages and style them confidently with practical Academy Class HTML and CSS training.

Explore HTML and CSS courses

Need a tailored route for your team? Speak to an Academy Class training adviser.