Tutorials HTML HTML Lists
Ch 8 / 40
Chapter 8 Beginner 7 min read HTML

HTML Lists — ul, ol, dl & Nested Lists

Lists are everywhere on the web — navigation menus, feature lists, step-by-step guides, definition glossaries. HTML provides three powerful list elements for every use case. In this chapter you'll master all three, learn how to nest them, customise their appearance, and apply accessibility best practices.

What you'll learn
The three HTML list types — <ul>, <ol>, <dl>
When to use each list type correctly
Ordered list attributes — type, start, reversed
Description lists with <dt> and <dd>
Nested lists — lists inside lists
Customising list styles with CSS list-style-type

The Three HTML List Types

HTML gives you three distinct list elements, each designed for a different kind of content. Choosing the right list type is both a semantic and accessibility decision.

Unordered List
<ul> <li>
Items where order does not matter. Renders with bullet points by default. Use for features, ingredients, navigation links, or any collection without a sequence.
  • HTML gives structure
  • CSS gives style
  • JavaScript adds behaviour
Ordered List
<ol> <li>
Items where sequence matters. Renders with numbers by default. Use for steps, rankings, instructions, or any content where position is meaningful.
  1. Create the HTML file
  2. Add content and tags
  3. Open in browser
Description List
<dl> <dt> <dd>
Term–definition pairs. Use for glossaries, FAQs, metadata, or any content that pairs a name with a description or value.
HTML
HyperText Markup Language
CSS
Cascading Style Sheets

Unordered List — <ul>

An unordered list wraps a collection of <li> (list item) elements. Each item renders with a bullet marker — disc by default. Use it whenever the order of items is not meaningful.

HTML — Unordered List
<ul>
  <li>HTML — builds the structure</li>
  <li>CSS  — styles the structure</li>
  <li>JavaScript — adds interactivity</li>
</ul>
Common Use Cases
Navigation menus, feature bullet points, tag lists, shopping cart items, ingredient lists — anything where the order doesn't matter.

Ordered List — <ol>

An ordered list also wraps <li> elements, but renders them with sequential numbers (or letters/roman numerals) by default. Use it whenever the order is meaningful — steps, rankings, instructions.

HTML — Ordered List with Attributes
<!-- Basic numbered list -->
<ol>
  <li>Download VS Code</li>
  <li>Create index.html</li>
  <li>Write your HTML</li>
  <li>Open in browser</li>
</ol>

<!-- Start from a custom number -->
<ol start="5">
  <li>Step five</li>
  <li>Step six</li>
</ol>

<!-- Reversed countdown -->
<ol reversed>
  <li>Gold medal winner</li>
  <li>Silver medal winner</li>
  <li>Bronze medal winner</li>
</ol>

<!-- Uppercase letters -->
<ol type="A">
  <li>Option A</li>
  <li>Option B</li>
  <li>Option C</li>
</ol>
Attribute Applied To Purpose Example
type <ol> Sets the marker type — 1 (default), A, a, I, i type="A"
start <ol> Sets the starting number for the list counter — useful for continuing a list split across sections start="5"
reversed <ol> Counts downward instead of up — useful for countdowns or reverse rankings reversed
value <li> Overrides the counter for a specific item — subsequent items continue from the new value value="10"

Description List — <dl>, <dt>, <dd>

A description list groups term–definition pairs using three elements: <dl> (the container), <dt> (the term), and <dd> (the description). One term can have multiple descriptions, and multiple terms can share one description.

HTML — Description List
<!-- Glossary of web terms -->
<dl>

  <dt>HTML</dt>
  <dd>HyperText Markup Language — the structure of a web page.</dd>

  <dt>CSS</dt>
  <dd>Cascading Style Sheets — controls colours, fonts, and layout.</dd>

  <dt>JavaScript</dt>
  <dd>A programming language that adds interactivity to web pages.</dd>
  <dd>Also used on the server via Node.js.</dd>

</dl>
When to Use
Use <dl> for glossaries, FAQ answer pairs, product metadata (weight, dimensions, colour), author bios, or any key–value data. It is semantically richer than using a table for this purpose.

Nested Lists — Lists Inside Lists

You can place any list type inside a <li> element to create nested lists. This is essential for multi-level navigation menus, site maps, and hierarchical content. The key rule is to always nest the child <ul> or <ol> inside the parent <li> — never directly inside <ul> or <ol>.

HTML — Nested Lists
<!-- Nested unordered list (nav menu) -->
<ul>
  <li>Courses
    <ul>
      <li>Web Development</li>
      <li>Python Masterclass</li>
      <li>Data Analysis</li>
    </ul>
  </li>
  <li>Tutorials
    <ul>
      <li>HTML Tutorial</li>
      <li>CSS Tutorial</li>
    </ul>
  </li>
  <li>About Us</li>
</ul>

<!-- Nested ordered inside unordered -->
<ul>
  <li>Frontend Technologies
    <ol>
      <li>HTML (learn first)</li>
      <li>CSS (learn second)</li>
      <li>JavaScript (learn third)</li>
    </ol>
  </li>
</ul>
Common Nesting Mistake
Never place a <ul> directly inside another <ul> without a wrapping <li>. The child list must always live inside a <li> — otherwise the HTML is invalid.

Customising Lists with CSS list-style-type

The CSS list-style-type property changes the marker style of any list. Here are the most commonly used values:

list-style-type: disc
  • Filled circle
  • Default for ul
list-style-type: circle
  • Hollow circle
  • Nested ul default
list-style-type: square
  • Filled square
  • Useful for sub-items
list-style-type: decimal
  1. Default for ol
  2. 1, 2, 3...
list-style-type: upper-alpha
  1. Uppercase A, B, C
  2. Great for exam options
list-style-type: upper-roman
  1. Roman numerals I, II
  2. Formal documents
list-style-type: lower-alpha
  1. Lowercase a, b, c
  2. Sub-steps and options
list-style-type: none
  • No marker at all
  • Used for nav menus
CSS — Customising list styles
/* Remove bullets — used on navigation menus */
nav ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

/* Custom marker colour via ::marker pseudo-element */
ul li::marker {
  color: #e44d26;
}

/* Remove default styling and add custom padding */
ul, ol {
  padding-left: 24px;
}

/* Uppercase letter list */
ol.options {
  list-style-type: upper-alpha;
}

Common Mistakes — Do's & Don'ts

These are the most frequent list mistakes beginners make:

Do — Correct
<!-- Child list inside <li> -->
<ul>
  <li>Courses
    <ul>
      <li>HTML</li>
      <li>CSS</li>
    </ul>
  </li>
</ul>

<!-- ol for ordered steps -->
<ol>
  <li>Download VS Code</li>
  <li>Create HTML file</li>
</ol>
Don't — Wrong
<!-- Nested list NOT inside <li> (invalid) -->
<ul>
  <li>Courses</li>
  <ul>  ← wrong! must be inside <li>
    <li>HTML</li>
  </ul>
</ul>

<!-- ol used for unordered content -->
<ol>
  <li>Apples</li>
  <li>Mangoes</li>
</ol>

Complete Example — Lists in a Real Page

Here is a realistic HTML snippet combining all three list types in a typical web page context:

HTML — All List Types Together
<section>

  <h2>Course Features</h2>
  <!-- Unordered: order doesn't matter -->
  <ul>
    <li>120+ video lessons</li>
    <li>10 real-world projects</li>
    <li>Placement support</li>
    <li>Certificate on completion</li>
  </ul>

  <h2>How to Enroll</h2>
  <!-- Ordered: sequence matters -->
  <ol>
    <li>Visit <a href="/courses.html">our courses page</a></li>
    <li>Choose a course</li>
    <li>Click Enroll and complete payment</li>
    <li>Start learning immediately</li>
  </ol>

  <h2>Course Details</h2>
  <!-- Description: term–value pairs -->
  <dl>
    <dt>Duration</dt>
    <dd>40 hours of recorded content</dd>
    <dt>Level</dt>
    <dd>Beginner to Advanced</dd>
    <dt>Language</dt>
    <dd>English & Hindi</dd>
  </dl>

</section>

Try It Yourself

Edit the lists below and click Open in Editor to see them live in full screen.

Live Editor
✎ Editor
👁 Preview
Try This
Change type="1" on the <ol> to type="A", type="a", or type="I" and watch the markers change. Try adding reversed or start="5" as attributes too.
Free Resource
HTML5 Cheat Sheet — All Tags & Attributes
One printable PDF covering all HTML list tags, attributes, nesting rules, and CSS list-style-type values.
Download PDF
Featured Course — Enroll Now
Modern Web Development With AI
Master HTML, CSS, JavaScript, React, and Node.js in one industry-ready curriculum with real projects and placement support.
120+
Chapters
40 hrs
Content
10
Projects
4.9 ⭐
Rating
HTML5 CSS3 JavaScript React.js Node.js MongoDB AI Tools

Quick Check — Chapter 8

Expand each question to check your understanding before moving on to the multiple choice quiz below.

Questions & Answers
<ul> (unordered list) is used when the order of items does not matter — it renders bullet points by default. <ol> (ordered list) is used when sequence is meaningful — it renders numbered markers by default. The rule of thumb: if you could rearrange the items without changing their meaning, use <ul>. If the order matters (steps, rankings, top 10 lists), use <ol>. Choosing the wrong one is a semantic error that affects accessibility and SEO.
A description list uses three elements. <dl> (description list) is the outer container — it wraps the entire list. <dt> (description term) defines the term or name being described — rendered bold by default. <dd> (description details) provides the definition or value for the preceding term — rendered with left indentation by default. One <dt> can be followed by multiple <dd> elements, and multiple <dt> elements can share one <dd>.
A child list must always be placed inside a <li> element of the parent list — never directly inside a <ul> or <ol>. The correct structure is: <ul> <li>Parent item <ul> <li>Child</li> </ul> </li> </ul>. Placing the child <ul> directly after a </li> but still inside the outer <ul> is invalid HTML and causes unpredictable rendering.
The type attribute changes the marker style — values are 1 (numbers, default), A (uppercase letters), a (lowercase letters), I (uppercase Roman numerals), and i (lowercase Roman numerals). The start attribute sets the starting number — for example start="5" begins counting at 5, which is useful for lists split across sections. The reversed attribute makes the list count downward — useful for countdowns or reverse rankings.
Navigation menus are semantically built with <ul> and <li> because a nav menu is genuinely a list of links. However, bullet markers are not visually appropriate for a horizontal or styled navigation bar. list-style-type: none removes the bullet markers entirely, while padding: 0; margin: 0 removes the default indentation — giving you a clean foundation to style the links with flexbox or CSS grid. This is the standard pattern used by every professional web developer.
The ::marker CSS pseudo-element targets the marker box of a list item — the bullet or number that appears before each <li>. Using it you can change the marker's colour, font size, or content without needing to wrap items in extra elements. For example: li::marker { color: #e44d26; font-weight: 700; } changes all bullets to orange and bold. It has broad browser support as of 2023 and is the modern, clean way to style list markers.
Multiple Choice Questions
MCQ 1 of 4
Which HTML tag is used to create an unordered (bulleted) list?
MCQ 2 of 4
Which attribute on <ol> makes the list count downward instead of up?
MCQ 3 of 4
In a description list, which tag defines the term being described?
MCQ 4 of 4
Which CSS value removes bullet markers from a list entirely?
Chapter Summary
  • <ul> — unordered list with bullet points. Use when order does not matter (features, ingredients, nav links).
  • <ol> — ordered list with numbers. Use when sequence matters (steps, rankings, instructions). Supports type, start, and reversed attributes.
  • <dl> with <dt> and <dd> — description list for term–definition pairs. Use for glossaries, FAQs, and metadata.
  • All three list types use <li> for items — except <dl> which uses <dt> and <dd>.
  • Nested lists must always place the child <ul> or <ol> inside a <li> — never directly inside the parent list element.
  • Use CSS list-style-type: none to remove markers — standard for navigation menus. Use ::marker to change marker colour or style.
~7 min read
Beginner level
Chapter 8 of 40

Rate Us on Google

4.8 / 5
Enjoying this tutorial?
If this tutorial helped you, a 5-star Google review means a lot. It helps other learners discover our free content and motivates us to keep improving.
500+ Reviews (Target)
Write a Google Review
Join WhatsApp Channel