Problem Statement
What does the reversed attribute do in an ordered list?
Explanation
The reversed attribute numbers an ordered list in descending order instead of ascending order. When you add the reversed attribute to an ol tag, the list counts down instead of up. For example, if you have three items, they will be numbered 3, 2, 1 instead of 1, 2, 3. This is useful for countdown lists, rankings from highest to lowest, or any situation where you want reverse numbering. The reversed attribute is a boolean attribute, which means you just add the word reversed without a value. The actual order of the items in the HTML does not change. Only the numbers displayed change. The reversed attribute works with all type values, including numbers, letters, and Roman numerals. This attribute was introduced in HTML5 and may not work in very old browsers, but it has excellent support in all modern browsers.
Code Solution
SolutionRead Only
<!-- Reversed numbering --> <ol reversed> <li>Bronze medal</li> <li>Silver medal</li> <li>Gold medal</li> </ol> <!-- Displays: 3. 2. 1. --> <!-- Reversed with start attribute --> <ol reversed start="10"> <li>Item ten</li> <li>Item nine</li> <li>Item eight</li> </ol> <!-- Displays: 10. 9. 8. --> <!-- Top 5 countdown --> <ol reversed start="5"> <li>Fifth place</li> <li>Fourth place</li> <li>Third place</li> <li>Second place</li> <li>First place</li> </ol> <!-- Displays: 5. 4. 3. 2. 1. -->
Practice Sets
This question appears in the following practice sets:
