Question

An ordered list, <ol>, containing items from the newest one to the oldest one should have the reversed attribute set? As to indicate reverse chronological order?

For example, in a list of blog posts, comments, threads or replies, should it be structured like this?

...
<ol reversed>
  <li>newest post<li>
  ...
  <li>oldest post</li>
</ol>
...

And in multi-page lists like this? Where start should be total_item_count - page * items_per_page so that is always assigns the proper value to each list item regardless of what page is being shown?

...
Page 4 of 5, showing 10 items per page, 43 items in total
<ol reversed start=13>
  <li>newest post in the page</li>
  ...
  <li>oldest post in the page</li>
</ol>
...

Or am I over thinking it?

Was it helpful?

Solution

Yes, if you use ol you can use the reversed and start attributes in the way you described.

But you probably shouldn’t use ol here.

ol is not simply for any sorted list. Only use ol if the order of the li is important for the (understanding of the) content.

From the ol definition (bold by me):

The ol element represents a list of items, where the items have been intentionally ordered, such that changing the order would change the meaning of the document.

Examples for ol:

  • search engine results (if ranked by relevance)
  • a list of favorite things (if ranked by favor)
  • a list of blog posts where each post is a chapter of a novel (so users should read them in this (and no other) order)

Examples for ul:

  • search engine results (if there is no ranking algorithm)
  • a list of favorite things (if you can’t decide which of those you like more)
  • a list of blog posts where each post can be read on its own (i.e. a typical blog)

Even if those last three examples are ordered chronologically or alphabetically, this doesn’t influence the meaning of the content.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top