🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEhtml

html Documentation

LOADING ENGINE...

<ol>

AI & DATA SCIENCE // ol-tag

The <ol> element represents an ordered list — items presented in a meaningful sequence — rendered as numbered items by default.

Syntax

<ol>
  <li>Preheat the oven</li>
  <li>Mix the ingredients</li>
  <li>Bake for 20 minutes</li>
</ol>

Deep Dive Course

**`<ol>`** numbers its `<li>` children automatically, and — unlike `<ul>` — the numbering carries real meaning: steps in a process, rankings, or anything where position matters. Useful attributes include **`start`** (the number to begin counting from), **`reversed`** (counts down instead of up), and **`type`** (switches between `1`, `a`, `A`, `i`, `I` numbering styles).

1Understanding <ol>

`<ol>` numbers its <li> children automatically, and — unlike <ul> — the numbering carries real meaning: steps in a process, rankings, or anything where position matters. Useful attributes include `start` (the number to begin counting from), `reversed` (counts down instead of up), and `type` (switches between 1, a, A, i, I numbering styles).

💡

You can override an individual item's number with the value attribute on a specific <li> (e.g. <li value="5">) — later items continue counting from that new number.

editor.html
<ol>
  <li>Sign up for an account</li>
  <li>Verify your email</li>
  <li>Complete your profile</li>
</ol>
localhost:3000

2Practical Example

Here is a real-world application of <ol> showing how it is used in production HTML.

editor.html
<!-- Countdown list starting at 3 -->
<ol start="3" reversed>
  <li>Third place</li>
  <li>Second place</li>
  <li>First place</li>
</ol>
localhost:3000

3Best Practices

Follow these guidelines when working with <ol>:

1. Use <ol> whenever the sequence/order of items is meaningful (steps, rankings)

2. Use start or reversed instead of manually typing numbers into the text

3. Use type="a" or type="i" for lettered/roman-numeral lists instead of styling numbers manually

⚠️

Tip: You can override an individual item's number with the value attribute on a specific <li> (e.g. <li value="5">) — later items continue counting from that new number.

editor.html
<ol>
  <li>Sign up for an account</li>
  <li>Verify your email</li>
  <li>Complete your profile</li>
</ol>
localhost:3000

Examples

Example 01Basic Usage
<ol>
  <li>Sign up for an account</li>
  <li>Verify your email</li>
  <li>Complete your profile</li>
</ol>
Example 02Advanced Example
<!-- Countdown list starting at 3 -->
<ol start="3" reversed>
  <li>Third place</li>
  <li>Second place</li>
  <li>First place</li>
</ol>

Best Practices

  • Use
      whenever the sequence/order of items is meaningful (steps, rankings)
    1. Use start or reversed instead of manually typing numbers into the text
    2. Use type="a" or type="i" for lettered/roman-numeral lists instead of styling numbers manually

Interview Question

How would you create a numbered list that counts down from 10 to 1?

Hint: Think about the reversed and start attributes together.

Use <ol start="10" reversed> with 10 <li> items — the reversed attribute flips the counting direction so the first item is numbered 10, and each subsequent item counts down by one, ending at 1 on the last item. Without reversed, start alone would count UP from 10 instead.

Exercises

EasyPractice using <ol> in a real scenario.
View Solution
<ol>
  <li>Sign up for an account</li>
  <li>Verify your email</li>
  <li>Complete your profile</li>
</ol>

Frequently Asked Questions

How would you create a numbered list that counts down from 10 to 1?

Use

    with 10
  1. items — the reversed attribute flips the counting direction so the first item is numbered 10, and each subsequent item counts down by one, ending at 1 on the last item. Without reversed, start alone would count UP from 10 instead.

Related Functions

ul-tagli-tag