In html exist the ol tag that allow you to show an ordered list.
and for the above code the result is the following:
But what about if you want to change the order number? You can use the value attribute for the li tag.
and the result will be:
Great, but there is another attribute that may be useful and give you the same result with less code. I am talking about the reversed attribute
much better because of the “less code” part!
Ok but now you have a section where you need to show the Top Ten Fruits. I know! You are thinking in an easy solution, just mix the reversed attribute with the value attribute, right?
Sure, that get the job done, but in this case there is other way using the start attribute.
<ol reversed start="10">
Good now you can have the same behavior but using only attributes for the ol tag.
All these examples will work fine in basically every browser, but worth mentioning a couple of things:
- start attribute for the ol tag was deprecated in html 4, but still supported in html 5.
- value attribute for the li tag was deprecated in html 4, but still supported in html 5.
Hope it helps!