Why lists matter

Lists are one of the most common content patterns on the web. Whether you're showing navigation links, recipe ingredients, numbered steps, or glossary terms, HTML lists help you organize information in a way that's both semantic (meaningful to browsers and search engines) and visually clear.

HTML gives you three types of lists:

  • Unordered lists (<ul>) โ€” bullet points, when order doesn't matter
  • Ordered lists (<ol>) โ€” numbered steps, rankings, or sequences
  • Description lists (<dl>) โ€” term-definition pairs, like a glossary or FAQ
SEO tip:
Screen readers and search engines understand list semantics. Using proper list tags makes your content more accessible and helps with rankings.

Unordered lists with <ul>

An unordered list displays items with bullet points. Use it when the sequence doesn't matter โ€” like a shopping list, features, or options.

unordered.html Basic unordered list

Each list item goes inside an <li> (list item) tag, and all items are wrapped in a <ul> tag. The <ul> itself doesn't display โ€” it's just a container that tells the browser "this is an unordered list."

Ordered lists with <ol>

Use ordered lists when sequence or ranking matters. Recipes, step-by-step instructions, top-10 lists, and algorithms all belong in <ol> tags.

ordered.html Basic ordered list

By default, <ol> uses Arabic numerals (1, 2, 3...). But you can customize the numbering with the type attribute and the start attribute.

Ordered list attributes

The <ol> tag supports powerful attributes to control numbering:

ol-attributes.html type, start, and reversed attributes

Here's a quick reference:

  • type="1" (default) โ€” Arabic numerals: 1, 2, 3...
  • type="A" โ€” Uppercase letters: A, B, C...
  • type="a" โ€” Lowercase letters: a, b, c...
  • type="I" โ€” Roman numerals (uppercase): I, II, III...
  • type="i" โ€” Roman numerals (lowercase): i, ii, iii...
  • start="N" โ€” Start counting at number N instead of 1
  • reversed โ€” Count down instead of up

Nested lists

You can nest lists inside other lists. This is perfect for outlines, tables of contents, or multi-level hierarchies. Just place a list inside an <li> element.

โœ๏ธ Try It Yourself โ€” Nested Lists
Preview
Nesting tip:
The nested list must be placed inside the <li> tag, not after it. Follow the golden rule: close </li> after the nested list, not before.

Description lists for glossaries

Description lists are perfect for glossaries, FAQ sections, or any term-definition pairs. They use three tags:

  • <dl> โ€” The description list container
  • <dt> โ€” The term (definition term)
  • <dd> โ€” The definition (description)
glossary.html Description lists with dl, dt, dd

Description lists are semantic and accessible. Screen readers understand the relationship between terms and definitions, making your content more usable for everyone.

Try it yourself: Recipe page

Let's combine unordered and ordered lists in a real recipe page. Edit the code to change the recipe or add more ingredients and steps.

โœ๏ธ Try It Yourself โ€” Recipe Lists
Preview

When to use each list type

Choosing the right list type makes your content clearer and more semantic:

๐Ÿ“‹
Use <ul>
Unordered lists

When the sequence doesn't matter. Examples: shopping lists, features, options, bullet-point summaries, navigation menus, checklist items (unordered).

1๏ธโƒฃ
Use <ol>
Ordered lists

When sequence or priority matters. Examples: step-by-step instructions, rankings, recipes, numbered steps, algorithms, countdowns.

๐Ÿ“–
Use <dl>
Description lists

For term-definition pairs. Examples: glossaries, FAQs, definitions, metadata (key-value pairs), specifications with descriptions.

Challenge: Build a Travel Packing List

Task: Create a packing list page with:

  • An <h1> title: "Travel Packing List"
  • An <ol> section "Packing Steps" with 4-5 steps
  • A <ul> section "Essential Items" with:
  • A nested <ul> for "Clothing" (3 items)
  • A nested <ul> for "Toiletries" (3 items)
  • A nested <ul> for "Electronics" (3 items)
  • A <dl> section with a "Travel Glossary" (4 terms and definitions)

Hint: Start with an <h1>. Add the packing steps as <ol>, then create the essential items section with <ul> and nested <ul> elements inside each <li>. Finally, add a <dl> with travel terms and definitions. Use the editors above as templates!

Common mistakes

  • Forgetting the container tag โ€” List items must be inside <ul>, <ol>, or <dl>. Bare <li> tags outside a list won't render correctly.
  • Using <ul> for step-by-step instructions โ€” If order matters, use <ol> instead. It's more semantic and helps readers understand the sequence.
  • Nesting in the wrong place โ€” Place nested lists inside the <li>, not after it. Wrong: <li>Item</li><ul>. Right: <li>Item<ul>...</ul></li>
  • Misusing description lists โ€” <dl> is not a general two-column layout tool. Use it only for term-definition relationships. For other purposes, use tables or divs with CSS.
  • Forgetting to close list item tags โ€” While some browsers auto-close <li>, always explicitly close them. It's a best practice for clean, valid HTML.

Key takeaways

  • Use <ul> for unordered lists โ€” bullet points when sequence doesn't matter.
  • Use <ol> for ordered lists โ€” numbered steps when sequence matters. Customize with type, start, and reversed.
  • Use <dl> for glossaries โ€” term-definition pairs are semantic and accessible.
  • Nest lists inside <li> elements to create hierarchies. Always close tags properly.
  • Lists are semantic โ€” They help screen readers, search engines, and humans understand content structure.

Test your knowledge

Question 1 of 5
Which tag creates an unordered list with bullet points?
Question 2 of 5
What attribute changes the numbering style in an ordered list?
Question 3 of 5
Which element defines a term in a description list?
Question 4 of 5
Can you nest a list inside another list?
Question 5 of 5
Which list type is best for step-by-step instructions?
0
/5
Great work! You understand lists.
Africa & India's Best AI Academy
๐Ÿค– AI-first ๐ŸŽ“ Placement Assistance

You just mastered lists.
Your web pages are getting structured.

Join the Best AI Programs โ€” three 5-month courses, fully online, with placement assistance. Week 1 is free.

Explore our AI-era courses โ†’