ol
The ordered list element represents a collection of items where the sequence is meaningful.
Description
The <ol> element creates a numbered list of items. Each item is wrapped in an <li> element. Use ordered lists when the sequence of items matters — such as steps in a process, rankings, or any content where position is significant.
By default, items are numbered with decimal numerals (1, 2, 3...) and have left padding for indentation.
When to Use
- Step-by-step instructions or tutorials
- Recipes with sequential steps
- Rankings or leaderboards
- Table of contents
- Legal document sections
- Any content where position matters
When Not to Use
Default
Standard ordered list with decimal numbering.
<ol> <li>First step in the process</li> <li>Second step in the process</li> <li>Third step in the process</li> <li>Fourth step in the process</li></ol>
Numbering Styles
Use the type attribute to change the numbering style.
| Type Value | Numbering Style | Example |
|---|---|---|
1 (default) |
Decimal numbers | 1, 2, 3... |
A |
Uppercase letters | A, B, C... |
a |
Lowercase letters | a, b, c... |
I |
Uppercase Roman | I, II, III... |
i |
Lowercase Roman | i, ii, iii... |
Start, Reversed, and Value
Control numbering with the start, reversed, and value attributes.
<ol> <li>Item 1</li> <li value="5">Jumps to 5</li> <li>Continues from 6</li></ol>
| Attribute | Values | Description |
|---|---|---|
type |
1, A, a, I, i |
Numbering style |
start |
Integer | Starting number |
reversed |
Boolean | Count down instead of up |
value (on <li>) |
Integer | Override a specific item's number |
Variants
.inline
Display list items horizontally. Numbers are removed in this variant.
.unstyled
Remove numbers and indentation for custom styling.
<ol class="inline"> <li>Step 1</li> <li>Step 2</li> <li>Step 3</li> <li>Step 4</li></ol>
<ol class="unstyled"> <li>First item (no number)</li> <li>Second item (no number)</li> <li>Third item (no number)</li></ol>
Nested Lists
Ordered lists can be nested, and can mix with unordered lists for complex hierarchical content.
<ol> <li>Gather ingredients <ul> <li>Flour</li> <li>Sugar</li> <li>Eggs</li> </ul> </li> <li>Mix dry ingredients</li> <li>Add wet ingredients</li> <li>Bake at 350°F</li></ol>
Accessibility
Screen Reader Behavior
- Announced as "list" with item count
- Each item announced with its number and position
- The
reversedattribute is reflected in announced numbers - Custom
startvalues are properly announced
Best Practices
- Use ordered lists only when sequence matters
- Keep step counts reasonable (avoid 50+ step lists)
- Consider breaking very long lists into sections
- Use
typeattribute for legal/academic numbering styles
CSS Properties
| Property | Value | Description |
|---|---|---|
padding-inline-start |
var(--size-l) |
Left indentation for list items |
Variant: .inline
| Property | Value |
|---|---|
display |
flex |
flex-wrap |
wrap |
gap |
var(--size-s) |
list-style |
none |
Related
Patterns Using This Element
The <ol> element serves as the semantic foundation for these patterns:
Timeline
Chronological events, order tracking, and activity feeds