Mastering HTML Ordered Lists: The <ol> Tag

Learn how to create structured, numbered lists for recipes, rankings, and instructions. Master attributes like 'type', 'start', and 'reversed'.

Lesson ProgressStep 1 of 10
  1. First Item
  2. Second Item
  3. Third Item
0 EXP

Let's learn about Ordered Lists. We use these when the sequence is important, like for a recipe or step-by-step directions.

Ordered List Basics: <ol> and <li>

An ordered list is used when the sequence of items is important. It's created with two tags:

  • <ol>: The "Ordered List" tag. This is the main container that wraps the entire list.
  • <li>: The "List Item" tag. Each individual item in the list must be wrapped in an <li> tag.
<ol>
  <li>First step</li>
  <li>Second step</li>
  <li>Third step</li>
</ol>

The browser will automatically render this with numbers: 1, 2, 3. The only element allowed to be a direct child of <ol> is <li>.

System Check

Which tag is the *only* valid direct child of an <ol> tag?

Advanced Holo-Simulations

0 EXP

Log in to unlock these advanced training modules and test your skills.


Achievements

🥇
List Creator

Construct a valid, multi-item ordered list.

🎨
List Customizer

Customize a list using 'type' and 'start' attributes.

🪆
Nesting Pro

Correctly nest one list inside of another.

Mission: Write a Recipe

Create an ordered list for the first two steps of a recipe: 1. Preheat oven. 2. Mix ingredients. Our AI assistant will provide real-time feedback.

A.D.A. Feedback:

> Awaiting input...

Challenge: Assemble the List

Drag the elements into the correct order to create a valid ordered list.

<li>Apples</li>
<ol>
</ol>
<li>Bananas</li>

Challenge: Complete the Attributes

Fill in the missing parts to make an ordered list that starts at 'C'.

<="A"="3">
  <li>Item C</li>
</ol>

Consult A.D.A.

Unlock with Premium

Community Holo-Net

Peer Project Review

Submit your "Recipe" project from the AI-coder module for feedback from other Net-Runners.

The Unsung Hero of Structure: Mastering HTML Lists

When you browse the web, you're constantly interacting with HTML lists, even if you don't realize it. Navigation menus, recipe instructions, product feature highlights, search results, and comment threads—all of these are built on the humble foundation of HTML list elements.

Using lists correctly isn't just about making bullet points or numbers appear on the page. It's one of the most important ways you can give **semantic structure** to your content. This tells browsers, search engines, and assistive technologies (like screen readers) what your content *means* and how it relates to itself.

The Big Question: Ordered (<ol>) vs. Unordered (<ul>)

This is the most fundamental choice you'll make. The decision is purely semantic: **Does the order of the items matter?**

  • Use <ol> (Ordered List) when the sequence is crucial. If re-sorting the items would change the meaning or outcome, <ol> is the correct choice.
    • Top 10 rankings
    • Step-by-step instructions (recipes, assembly)
    • Turn-by-turn directions
  • Use <ul> (Unordered List) when the items are simply a group, and their order is irrelevant.
    • A shopping list (milk, bread, eggs)
    • A list of product features
    • Navigation links in a site's header

Choosing the wrong one is a common semantic error. A list of ingredients should be a <ul>, but the *steps* to make the dish must be an <ol>.

Anatomy of a List: The <li> Tag

Both <ol> and <ul> tags are containers. The actual content lives inside the <li> (List Item) tag. A critical rule of HTML is that **the only valid direct child of an <ol> or <ul> is an <li> tag.**

✔️ Good Practice

<ol>
  <li>Item 1</li>
  <li>Item 2</li>
</ol>

<li> tags are directly inside the <ol>.

❌ Bad Practice

<ol>
  <p>Item 1</p>
  <div>Item 2</div>
</ol>

Invalid HTML. Text and <p> tags cannot be direct children of <ol>.

Advanced <ol>: Attributes

Ordered lists have powerful attributes (though styling is often left to CSS today):

  • type: Changes the numbering style.
    • type="1": Numbers (default)
    • type="A": Uppercase letters
    • type="a": Lowercase letters
    • type="I": Uppercase Roman numerals
    • type="i": Lowercase Roman numerals
  • start: Specifies the number the list should start on. <ol start="3"> will begin counting from "3". If you use type="A" and start="3", the list will start with "C".
  • reversed: A boolean attribute that makes the list count down. <ol reversed> will render "3, 2, 1".

The Power of Nesting

This is where beginners often get stuck. To create a sub-list, you must place the *entire* new <ol> or <ul> element **inside an <li>** , after the item's content.

<ol>
  <li>First Item</li>
  <li>Second Item
    
    <ul>
      <li>Sub-item 2.1</li>
      <li>Sub-item 2.2</li>
    </ul>
  </li>
  <li>Third Item</li>
</ol>

Don't Forget: Description Lists

While less common, HTML also provides a third type of list: the Description List (<dl>). This list is for groups of terms (<dt>) and their corresponding definitions or descriptions (<dd>). It's perfect for glossaries or metadata pairs.

Key Takeaway: Don't just think of lists as bullet points. Think of them as a way to group related content. Always ask "does order matter?" to choose between <ol> and <ul>, and remember to nest new lists *inside* <li> tags.

HTML Lists Glossary

<ol> (Ordered List)
The container element for a list where the sequence of items is important. By default, items are rendered with numbers.
<ul> (Unordered List)
The container element for a list where the sequence of items is *not* important. By default, items are rendered with bullet points.
<li> (List Item)
Defines an individual item within a list. It is the only valid direct child of an <ol> or <ul> tag.
Nesting (Lists)
The practice of placing a new list (<ol> or <ul>) *inside* of an <li> tag to create a sub-list or hierarchy.
type attribute
An attribute for the <ol> tag that changes the marker style. Valid values are "1" (default), "A", "a", "I", and "i".
start attribute
An attribute for the <ol> tag that specifies the starting number of the list. For type="A", start="3" would begin the list at "C".
reversed attribute
A boolean attribute for the <ol> tag that, when present, makes the list's numbering count down instead of up.
list-style-type (CSS Property)
The modern, preferred way to change the visual appearance of list markers (e.g., to circles, squares, or even custom images). It is more flexible than the HTML type attribute.
<dl> (Description List)
A container element for a list of terms and their descriptions.
<dt> (Description Term)
Used inside a <dl> to specify the term being defined (e.g., a word in a glossary).
<dd> (Description Details)
Used inside a <dl> to provide the definition or description for the preceding <dt>.

Credibility and Trust

About the Author

Author's Avatar

Todotutorial Team

Passionate developers and educators making programming accessible to everyone.

This article was written and reviewed by our team of web development experts, who have years of experience teaching HTML and building robust and accessible web applications.

Verification and Updates

Last reviewed: October 2025.

We strive to keep our content accurate and up-to-date. This tutorial is based on the latest HTML5 specifications and is periodically reviewed to reflect industry best practices.

External Resources

Found an error or have a suggestion? Contact us!