reversed
Control ordered list numbering direction and start value. Covers reversed, start, and value attributes on ol and li elements.
Overview
The reversed attribute on <ol> reverses the numbering direction so the list counts down instead of up. Combined with start (on <ol>) and value (on <li>), you have full control over ordered list numbering.
Applies to:
reversed—<ol>onlystart—<ol>onlyvalue—<li>within an<ol>
Values
| Attribute | Element | Value | Effect |
|---|---|---|---|
reversed | <ol> | Boolean (no value) | Numbers count down from the total number of items |
start | <ol> | Integer | Sets the starting number for the first item |
value | <li> | Integer | Overrides the counter for that specific item; subsequent items continue from this value |
Reversed Lists
A reversed list counts down from the number of items. A list with 5 items numbers them 5, 4, 3, 2, 1.
Custom Start Value
The start attribute sets the first number. This is useful when a list is split across sections and the second part should continue the numbering.
Combined: Countdown from a Number
Use reversed and start together for top-N countdown lists. Set start to the highest number you want.
Overriding Individual Items
The value attribute on a <li> overrides the counter for that item. Subsequent items continue incrementing (or decrementing, if reversed) from the new value.
List Style Types
The reversed and start attributes work with any list-style-type — Roman numerals, letters, and other numbering systems all reverse correctly.
Accessibility
- Screen readers announce the list item numbers correctly, regardless of
reversedorstartvalues. - The semantic ordering is communicated to assistive technology — a reversed list is read in its visual order (top to bottom), with the descending numbers.
- Do not use CSS
counter-reset/counter-incrementto fake reversed numbering — it does not communicate the correct semantics to assistive technology.
Limitations
- The
reversedattribute only applies to<ol>. It has no effect on<ul>. - The
startattribute accepts only integers. It does not accept Roman numerals or letters even whenlist-style-typeuses them. - When
reversedis used withoutstart, the count begins at the total number of<li>elements. Dynamically adding items changes the starting number, which can be unexpected. - The
valueattribute on<li>resets the counter, which affects all subsequent items. There is no way to override a single item without affecting the ones after it.