HTML Lists

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 6 Examples + 6 Try It
ul / ol / dl

Introduction

HTML lists are a fundamental way to display related items in a structured format. They organize information in a clear hierarchy, making content easier to scan and understand.

HTML supports three main types of lists: unordered lists, ordered lists, and definition lists. This tutorial covers each type, nesting, CSS styling, pitfalls, and six hands-on examples.

What You’ll Learn

01

ul

Bullet lists.

02

ol

Numbered steps.

03

li

List items.

04

dl

Term + desc.

05

Nesting

Sub-lists.

06

CSS

Style bullets.

Types of HTML Lists

There are three main types of lists in HTML:

  1. Unordered lists (<ul>) — displayed as bullet points when order does not matter.
  2. Ordered lists (<ol>) — displayed with numbers or letters when sequence matters.
  3. Definition lists (<dl>) — used for terms and their descriptions.

Each type serves a different purpose, but they all follow a simple structure that makes organizing content straightforward.

💡
Beginner Tip

Every list item must be wrapped in <li> (for ul/ol) or paired as <dt> + <dd> (for dl). Place items inside the list container—never after the closing tag.

Unordered Lists (<ul>)

An unordered list displays items in no particular order. Each item is typically marked with a bullet point. The basic structure is:

html
<ul>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</ul>

By default, browsers display unordered list items with solid round bullets, but you can customize this with CSS list-style-type. See the ul tag reference for details.

Ordered Lists (<ol>)

An ordered list presents items in a specific sequence. This is useful when order matters—steps in a process, rankings, or instructions:

html
<ol>
  <li>Step 1</li>
  <li>Step 2</li>
  <li>Step 3</li>
</ol>

By default, items are numbered 1, 2, 3… Change the style with CSS instead of the deprecated HTML type attribute:

css
ol.letters {
  list-style-type: upper-alpha; /* A, B, C */
}

ol.roman {
  list-style-type: upper-roman; /* I, II, III */
}

Learn more in the ol tag reference and list-style-type CSS property.

Definition Lists (<dl>)

A definition list pairs terms with their descriptions. It is often used for glossaries or to explain concepts. A definition list consists of:

  • <dt> — defines the term (definition term).
  • <dd> — describes the term (definition description).

Example

html
<dl>
  <dt>HTML</dt>
  <dd>A markup language for creating web pages.</dd>

  <dt>CSS</dt>
  <dd>A stylesheet language for designing the look of web pages.</dd>
</dl>

One term can have multiple dd elements if several descriptions apply. See the dl tag reference.

Nested Lists

Lists can be nested within other lists to create multi-level structures—sub-categories, outlines, or steps within steps. Place the inner list inside an li element:

html
<ul>
  <li>Main Item 1
    <ul>
      <li>Sub Item 1.1</li>
      <li>Sub Item 1.2</li>
    </ul>
  </li>
  <li>Main Item 2</li>
</ul>

Sub-items appear indented under the parent item. You can mix ul and ol at different levels (e.g. numbered steps with bullet sub-points).

Styling Lists

CSS customizes bullet type, numbering style, and spacing:

css
ul {
  list-style-type: square; /* square bullets */
}

ol {
  list-style-type: upper-roman; /* I, II, III */
}

li {
  margin-bottom: 0.25rem;
}

Remove bullets entirely for navigation-style menus:

css
ul.nav {
  list-style-type: none;
  padding-left: 0;
}

Common list-style-type values: disc, circle, square, decimal, lower-alpha, upper-alpha, lower-roman, upper-roman, and none.

Common Pitfalls

  • Incorrect nesting — nested lists must sit inside an li, not directly inside another ul or ol alongside sibling li elements.
  • Items outside the container — every li must be inside ul or ol. Closing the tag before items breaks the list.
  • Wrong list type — use ul when order is irrelevant; use ol when sequence matters (recipes, instructions).
  • Manual bullets — typing “- Item” in a paragraph is not a real list. Use semantic markup for accessibility.
  • Deprecated attributes — prefer CSS over the HTML type attribute on ol.

⚡ Quick Reference

ElementPurpose
<ul>Unordered (bullet) list
<ol>Ordered (numbered) list
<li>Single list item
<dl>Definition list container
<dt>Term to define
<dd>Term description
list-style-typeCSS: bullet/number style
list-style: noneCSS: remove markers

Examples Gallery

Six examples from a simple bullet list to a full page with every list type. Each includes View Output and Try It Yourself.

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

ul wraps the list; each li is one bullet item. Order does not matter.

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

ol numbers items automatically. Step order is preserved for the reader.

Example 3 — Definition 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

dt is the term; dd is the explanation. Ideal for glossaries and metadata.

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

CSS list-style-type changes markers without changing HTML structure.

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

The inner ul lives inside the parent li, creating an indented sub-list.

Example 6 — Complete Lists Page

Full example combining unordered, ordered, nested, and definition lists:

html
<!DOCTYPE html>
<html lang="en">
<head>
  <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>
  <!-- ul, ol, nested ul, and dl sections -->
</body>
</html>
Try It Yourself

How It Works

Demonstrates every list type from this tutorial on one page with light CSS styling.

Best Practices

✅ Do

  • Use ul when order is irrelevant
  • Use ol for steps, rankings, and sequences
  • Nest sub-lists inside li elements
  • Style markers with CSS list-style-type
  • Keep list items concise and parallel in structure

❌ Don’t

  • Type manual dashes instead of real lists
  • Close ul/ol before li items
  • Use ol for unordered feature lists
  • Rely on deprecated type attribute on ol
  • Nest lists directly without wrapping in li

Universal Browser Support

HTML list elements are supported in every browser. CSS list-style-type values work in all modern browsers; test custom styles on mobile if navigation depends on them.

Baseline · Since HTML

HTML list elements

HTML list elements are supported in every browser. CSS list-style-type values work in all modern browsers; test custom styles on mobile if navigation depends on them.

100% Core tag support
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 list elements Universal

Bottom line: Lists are among the oldest, most reliable HTML features.

Conclusion

HTML lists provide a simple and effective way to organize information. Understanding unordered, ordered, and definition lists—and how to nest and style them—helps you structure content that is readable, accessible, and easy to maintain.

Next, style text inside your lists with HTML Inputs to collect user data in forms, or explore tag references for ul, ol, and li.

Key Takeaways

02

ul

No order.

Bullets
🔢 03

ol

Sequence.

Steps
📖 04

dl

Glossary.

Terms
🎨 05

CSS

Style it.

Design

❓ Frequently Asked Questions

Unordered lists (ul) use bullet points for items with no required order. Ordered lists (ol) use numbers or letters when sequence matters. Definition lists (dl) pair terms (dt) with descriptions (dd), like a glossary.
Use ul when order does not matter—shopping lists, features, navigation menus. Use ol when steps or ranking matter—recipes, tutorials, top-10 lists. Each item is always an li inside the list container.
Definition lists (dl) group a term (dt) with one or more descriptions (dd). Use them for glossaries, metadata (name/value pairs), and FAQ-style content where a term needs an explanation.
Place a new ul or ol inside an li element—not directly inside another ul/ol. The inner list becomes a sub-list indented under that parent item.
Use CSS list-style-type on ul or ol—e.g. circle, square, upper-roman, upper-alpha. The HTML type attribute on ol is deprecated; CSS is the modern approach.
Yes. Set list-style-type: none on the ul or ol. This is common for navigation menus. Keep semantic list markup so screen readers still understand the structure.
Did you know?

The HTML menu element once represented toolbars and context menus. Today, use ul with list-style: none for navigation, or the semantic nav element wrapping a list of links.

Build lists in the editor

Create bullet lists, numbered steps, and glossaries, then preview them live.

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.

6 people found this page helpful