deCODE - Our Newsletter for Jan 2022 is available for Download. 🗞   🥳
  Signup/Sign In

How to create HTML list in descending order numbers?

Answer: By specifying reversed keyword within the <ol> tag.

The ordered list is used to add multiple items with some sequence or order. Generally, the ordered list is created with ascending order numbers.

But it is also possible to create the HTML ordered list in descending order. Let's learn how to do this.

Creating a list in descending order

We can specify the numbers in the ordered list in descending order. This can be done by adding the reversed attribute within the <ol> tag. Here is an example to create an ordered list with descending order numbers.

<!DOCTYPE html>
<html lang="en">
<head>
  <title>HTML </title> 
</head>
<body>
    <h2> Reversed ordered List </h2>
	<ol reversed>
	  <li> case 1</li>
	  <li> case 2</li>
	  <li> case 3</li>
	  <li> case 4</li>
	</ol>
</body>
</html>

Output

Here is the output of the above program.

reversed ordered list

Descending order for roman numbers

The reversed attribute can be used to reverse the order of the roman numbers too. Here, we have added type="I" which will create an uppercase roman number, and along with it, we have added the reversed attribute so the order can be reversed.

Conclusion

So, we can easily create a descending order number list in HTML. Use the reversed attribute for it. It is to be noted that it will only reverse the numbers and not the position of the items.