← #31 Check if the browser supports for an element attribute
#32

Create a descending list of numbered items

Topics: HTML

By default, an ordered list element (ol tag) will display the number for each item in the ascending order.
The first item is shown with the number 1. The second item comes with number 2, and so forth.

There are some cases that we would like to reverse the order of numbers, but the actual items are kept.
Coundowns such as top 5 movies, top 10 songs, etc., are the best examples for the use case.

To do that, we just simply add the reversed attribute:

<ol reversed>
<li>...</li>
<li>...</li>
<li>...</li>
</ol>

You can use the start attribute which indicates the start number.

Demo

Top 10 movies rated on IMDB

  1. The Lord of the Rings: The Fellowship of the Ring (2001)
  2. The Good, the Bad and the Ugly (1966)
  3. Pulp Fiction (1994)
  4. The Lord of the Rings: The Return of the King (2003)
  5. Schindler's List (1993)
  6. 12 Angry Men (1957)
  7. The Dark Knight (2008)
  8. The Godfather: Part II (1974)
  9. The Godfather (1972)
  10. The Shawshank Redemption (1994)
Fix a typo or suggest an improvement
#33 Create an autocomplete list with the datalist element