Codectionary / Developer documentation / HTML

<ol>

The <ol> element represents an ordered (numbered) list, where the sequence of items is meaningful. Like <ul>, every item must be wrapped in an <li> element. Browsers automatically number items starting from 1, but this can be customized using the start and reversed attributes, or a different numbering style with the type attribute. Ordered lists are ideal for step-by-step instructions, rankings, and recipes.

Syntax

<ol>
  <li>First step</li>
  <li>Second step</li>
</ol>

Examples

Basic Numbered List

Step-by-step instructions using an ordered list.

<ol>
  <li>Preheat the oven to 350°F</li>
  <li>Mix the dry ingredients</li>
  <li>Add wet ingredients and stir</li>
  <li>Bake for 25 minutes</li>
</ol>

Custom Start Number

Starting the list count from a specific number.

<ol start="5">
  <li>Step five</li>
  <li>Step six</li>
  <li>Step seven</li>
</ol>

Reversed and Custom Type

Counting down and using letters instead of numbers.

<ol reversed>
  <li>Third place</li>
  <li>Second place</li>
  <li>First place</li>
</ol>

<ol type="A">
  <li>Option A</li>
  <li>Option B</li>
</ol>

Attributes

  • start (number): Sets the starting number of the list (default is 1)
  • reversed (boolean): Numbers the list in descending order
  • type (1 | A | a | I | i): Sets the numbering style: numbers, letters, or Roman numerals

Best practices

  • Use <ol> whenever the sequence of items carries meaning, such as instructions or rankings
  • Use the start attribute rather than manually numbering items in the text
  • Reach for the reversed attribute for countdowns instead of reordering the markup
  • Keep list item text parallel in structure and grammar for readability

At a glance

Purpose
Structure and meaning for web content
File extension
.html · .htm
Runs in
Web browsers
Usually used with
CSS and JavaScript

Specifications & further reading

Related HTML documentation