← Back toFront-end tips

Create a descending list of numbered items

Written byPhuoc Nguyen
Created
24 Feb, 2021
Category
Tip
Tags
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:
html
<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)

See also

If you found this post helpful, please consider giving the repository a star on GitHub or sharing the post on your favorite social networks 😍. Your support would mean a lot to me!

Questions? 🙋

Do you have any questions about front-end development? If so, feel free to create a new issue on GitHub using the button below. I'm happy to help with any topic you'd like to learn more about, even beyond what's covered in this post.
While I have a long list of upcoming topics, I'm always eager to prioritize your questions and ideas for future content. Let's learn and grow together! Sharing knowledge is the best way to elevate ourselves 🥷.
Ask me questions

Recent posts ⚡

Newsletter 🔔

If you're into front-end technologies and you want to see more of the content I'm creating, then you might want to consider subscribing to my newsletter.
By subscribing, you'll be the first to know about new articles, products, and exclusive promotions.
Don't worry, I won't spam you. And if you ever change your mind, you can unsubscribe at any time.
Phước Nguyễn