HTML Lists

Beginner
12 min read
Updated: Nov 2026
6 examples
ul / ol / dl

Definition and Usage

HTML lists group related items so browsers, screen readers, and search engines understand they belong together. HTML provides three kinds: unordered (ul), ordered (ol), and description (dl) lists.

When does order matter?

If items can be shuffled without changing meaning (shopping, features, tags), use <ul>. If sequence is the point (recipe steps, directions, rankings), use <ol>.

What about terms and definitions?

Use a <dl> with <dt> (term) and <dd> (description) for glossaries, FAQs, and name–value style content.

Where else do lists appear?

Navigation menus are often a ul of links inside <nav>. Nested lists build outlines and sub-steps under a parent item.

Structure first.

Choose ul, ol, or dl by meaning. Change bullets or numbers with CSS later.

Do not fake lists with <br>.

Separate lines of text are not a list. Real list markup helps accessibility and styling.

Hub vs tag pages.

This tutorial compares all three list types. Deep notes for each element live on ul, ol, li, and dl.

HTML Syntax

The three list patterns you will use most:

HTML
<ul>
  <li>milk</li>
  <li>eggs</li>
  <li>bread</li>
</ul>
HTML
<ol>
  <li>Drive to the end of the road</li>
  <li>Turn right</li>
  <li>The school is on your right</li>
</ol>
HTML
<dl>
  <dt>HTML</dt>
  <dd>Markup language for web pages.</dd>
  <dt>CSS</dt>
  <dd>Stylesheet language for design.</dd>
</dl>
HTML
<ol>
  <li>Process into a paste.
    <ul>
      <li>Short blend for chunky hummus</li>
      <li>Longer blend for smooth hummus</li>
    </ul>
  </li>
</ol>

Core HTML Concepts

Tags and when to reach for them:

ElementRole
<ul>Unordered (bullet) list
<ol>Ordered (numbered) list
<li>One item inside ul or ol
<dl>Description / definition list
<dt>Term / name in a dl
<dd>Description / value (one term can have several)

Choose the right list

ContentUse
Shopping / features / tagsul
Steps / directions / rankingsol
Glossary / FAQ pairsdl + dt/dd
Site menu linksnav > ul > li > a
Sub-bullets under a stepNested ul/ol inside an li

Useful attributes & CSS

ToolEffect
type on ol1, A, a, I, i
start on olStart numbering at a value other than 1
reversed on olCount downward
CSS list-style-typeChange bullets / numbers without changing meaning

How to Write Lists in HTML

A simple workflow:

  1. Ask: does order matter, or is this terms + explanations?
  2. Open ul, ol, or dl.
  3. Wrap each item in li (or dt/dd for descriptions).
  4. Nest sub-lists inside the parent li, not beside it.
  5. Style markers with CSS if needed—keep the HTML semantic.
GoalHTML pattern
Bullet list<ul><li>…</li></ul>
Numbered steps<ol><li>…</li></ol>
Term + meaning<dl><dt>…</dt><dd>…</dd></dl>
Sub-items<li>Parent<ul>…</ul></li>

Live Preview

Switch between the three list types and see default browser rendering.

Same content, different list semantics.

Preview

HTML Examples

Six patterns: unordered, ordered, description, CSS markers, nesting, and a full page.

Example 1 — Unordered List

HTML
<h1>Shopping list</h1>
<ul>
  <li>Milk</li>
  <li>Bread</li>
  <li>Eggs</li>
</ul>
Try It Yourself

How It Works

  1. ul wraps the whole list.
  2. Each li is one bullet item.
  3. Order of items is not meaningful.
  4. Browsers show default disc bullets.

Example 2 — Ordered List

HTML
<h1>Recipe steps</h1>
<ol>
  <li>Preheat the oven to 180°C</li>
  <li>Mix the dry ingredients</li>
  <li>Bake for 25 minutes</li>
</ol>
Try It Yourself

How It Works

  1. ol numbers items automatically.
  2. Sequence is part of the meaning.
  3. Same li children as unordered lists.
  4. Directions and tutorials usually use this pattern.

Example 3 — Description List

HTML
<dl>
  <dt>HTML</dt>
  <dd>A markup language for creating web pages.</dd>
  <dt>CSS</dt>
  <dd>A stylesheet language for designing web pages.</dd>
</dl>
Try It Yourself

How It Works

  1. dt names the term.
  2. dd explains it (indent by default).
  3. One dt may be followed by several dds.
  4. Glossaries and FAQs fit this model well.

Example 4 — Styled Lists with CSS

HTML
<style>
  ol.alpha { list-style-type: upper-alpha; }
  ul.circle { list-style-type: circle; }
</style>
<ol class="alpha">
  <li>Item A</li>
  <li>Item B</li>
</ol>
Try It Yourself

How It Works

  1. HTML stays ol / ul.
  2. list-style-type only changes the marker look.
  3. Meaning (ordered vs unordered) does not change.
  4. Prefer CSS over presentational markup for markers.

Example 5 — Nested List

HTML
<ul>
  <li>HTML Basics
    <ul>
      <li>Headings</li>
      <li>Paragraphs</li>
    </ul>
  </li>
  <li>CSS Basics</li>
</ul>
Try It Yourself

How It Works

  1. Inner ul sits inside the parent li.
  2. Browsers indent the sub-list automatically.
  3. Valid nesting never places ul as a direct child of ul.
  4. Mix types (ol with nested ul) when sub-choices are unordered.

Example 6 — Complete Lists Page

Combine unordered, ordered, nested, and description lists:

HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>HTML Lists Example</title>
  <style>
    ul { list-style-type: circle; }
    ol { list-style-type: upper-alpha; }
  </style>
</head>
<body>
  <h1>HTML Lists Example</h1>

  <h2>Unordered List</h2>
  <ul>
    <li>Apple</li>
    <li>Banana</li>
  </ul>

  <h2>Ordered List</h2>
  <ol>
    <li>First step</li>
    <li>Second step</li>
  </ol>

  <h2>Definition List</h2>
  <dl>
    <dt>HTML</dt>
    <dd>Markup for structure.</dd>
  </dl>
</body>
</html>
Try It Yourself

How It Works

  1. One page can mix all three list types.
  2. Headings label each section for clarity.
  3. CSS only restyles markers.
  4. Try It opens the full editable demo.

Edge Cases & Pitfalls

Most list bugs are wrong list type or invalid nesting.

type

Using ol when order does not matter

Numbers imply sequence. Prefer ul for feature lists and tags.

nest

List as a sibling of li

Put the nested ul/ol inside the parent li.

fake

Fake lists with dashes and <br>

Screen readers will not announce a real list. Use list elements.

dl

Using dl for ordinary bullets

dl is for name/description pairs, not a substitute for ul.

div

Wrapping every li in a div for styling

Style li directly when you can. Keep the list structure clean.

css

Removing markers without a replacement

If you set list-style: none for a menu, ensure focus and structure stay clear.

Browser Support

ul, ol, li, and dl/dt/dd are foundational HTML and work in every browser. Prefer semantic lists; style markers with CSS.

✓ Baseline · Universally available

HTML list elements

Unordered, ordered, and description lists are supported everywhere HTML is rendered.

100% List elements
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
HTML lists Universal

Bottom line: Pick ul, ol, or dl by meaning—then tune bullets and numbers with CSS.

Key Takeaways

  • ul when order does not matter; ol when it does.
  • dl / dt / dd for terms and descriptions.
  • Nest sub-lists inside the parent li.
  • Style markers with CSS; keep the HTML semantic.

One line: Pick ul, ol, or dl by what the content means—then wrap each item in li (or dt/dd).

Frequently Asked Questions

HTML lists group related items with structure. Use ul for bullets when order does not matter, ol when sequence matters, and dl for term–description pairs.
Use ul for shopping lists, features, and nav menus where order is flexible. Use ol for steps, rankings, and instructions where the sequence matters.
A dl wraps terms (dt) and descriptions (dd). Use it for glossaries, FAQs, and name–value style content—not for ordinary bullets.
Yes. Put a ul or ol inside an li of the parent list. Do not place a list as a direct child of ul/ol without wrapping it in li.
Yes. A ul of links inside nav is a common, accessible pattern for menus.
Keep the HTML semantic (ul/ol) and change markers with CSS list-style-type, or use the type attribute on ol for simple cases.

Practice in the editor

Open a Try It demo and mix unordered, ordered, and description lists.

Open Try It editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful