HTML
    reversed Attribute



The reversed attribute of the <ol> element in HTML is used to set reversed ordering of list items in an ordered list. It displays the numbering in descending order and introduced in HTML5.

Following is the syntax −

<ol reversed>

Let us now see an example to implement the reversed attribute of the <ol> element −

Example

 Live Demo

<!DOCTYPE html>
<html>
<body>
<h2>Rank in Descending order</h2>
<ol reversed>
   <li>Tom</li>
   <li>Jack</li>
   <li>Will</li>
   <li>Harry</li>
   <li>Tim</li>
   <li>Steve</li>
   <li>David</li>
   <li>Kane</li>
   <li>William</li>
   <li>John</li>
</ol>
</body>
</html>

Output

In the above example, we have set an unordered list with the following list items under <li> −

<li>Tom</li>
<li>Jack</li>
<li>Will</li>
<li>Harry</li>
<li>Tim</li>
<li>Steve</li>
<li>David</li>
<li>Kane</li>
<li>William</li>
<li>John</li>

The above goes under the <ol> element for an unordered list. To apply for reversed order, use the reversed attribute −

<ol reversed>
<li>Tom</li>
<li>Jack</li>
<li>Will</li>
<li>Harry</li>
<li>Tim</li>
<li>Steve</li>
<li>David</li>
<li>Kane</li>
<li>William</li>
<li>John</li>
</ol>

Advertisements