Reverse Ordered Lists in HTML 5

Album Cover: White Blood Cells

"Every breath that is in your lungs is a tiny little gift to me."
White Stripes / Dead Leaves and the Dirty Ground

Posted on April 29, 2008 12:06 AM in Web Development
Warning: This blog entry was written two or more years ago. Therefore, it may contain broken links, out-dated or misleading content, or information that is just plain wrong. Please read on with caution.

I've always kinda wondered why you couldn't reverse ordered lists in HTML, especially given people's propensity for counting down in "top ten" lists. Via The WHATWG Blog, Lachlan Hunt shares the news that ordered lists can be reversed in HTML 5:

These are the same as ordered lists, but instead of counting up from 1, they instead count down towards 1. This can be used, for example, to count down the top 10 movies, music, or LOLCats, or anything else you want to present as a countdown list.

Through the use of a reversed and an optional start attribute on the ol tag, one can reverse an ordered list and even dictate what number the list starts counting down from. A key thing to remember is that in XHTML, the attribute has to be used somewhat redundantly, by specifying reversed="reversed".

Head on over to The WHATWG Blog for all the details, including some examples of the new feature put into use in various ways.

Comments

gohjalst on May 15, 2017 at 5:23 AM:

Post Comments

If you feel like commenting on the above item, use the form below. Your email address will be used for personal contact reasons only, and will not be shown on this website.

Name:

Email Address:

Website:

Comments:

Check this box if you hate spam.