HTML Ordered Lists: Numbering and List Values
Represent a sequence
Use ol when positions matter, such as instructions or rankings. Its li children are ordinarily numbered automatically. Leave the numbers out of the item text so the browser can maintain the sequence when items are inserted.
<ol> <li>Open the notebook.</li> <li>Write the date.</li> <li>Record your notes.</li></ol>Default numbering begins at 1 and increases for each item.
Continue or reverse numbering
Use the integer start to begin at a chosen ordinal. The Boolean attribute reversed makes numbering descend. When reversed is present without start, the starting ordinal is normally the number of list items. Writing reversed="false" does not turn it off; remove the attribute instead.
<ol start="5" reversed> <li>Round five</li> <li>Round four</li> <li>Round three</li></ol>The displayed ordinals are 5, 4 and 3. Remove reversed to count upward from 5.
Override an item ordinal
The value attribute on an ordered list item sets its ordinal; the following items continue from that value in the current direction. The type attribute of ol chooses marker representation: 1, a, A, i or I. Even with letters or Roman numerals, start and value take integers. Use styling for purely decorative choices.
<ol type="A" start="2"> <li>Introduction</li> <li value="5">Exercises</li> <li>Summary</li></ol>The markers are B, E and F, respectively. The list still represents an ordered sequence.
Practice and next steps
Predict the ordinals before running each example. Complete the checklist exercise, then learn about name-value groups.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Ordered Lists: Numbering and List Values — Knowledge Check
Check the core concepts from this lesson.
What numbers appear in a three-item ol with start="4"?
How do you turn off reversed numbering?
An ascending ordered list has an item with value="8". What is the next ordinary item ordinal?
A three-item ol has reversed and no explicit start. What is its ordinary initial sequence?
Which attribute changes the marker style of an ordered list to uppercase letters?