You’re here

Last published article

My take on ordered lists

Yesterday I was reading some articles from the excellent Opera Web Standards Curriculum (by the way, kudos Opera!) and I noticed that the index of their work was composed by several ordered lists, each one continuing its counting from its predecessor.

Now, setting the list to start counting from a value different than 1 (or, if you prefer, a., A., I., whatever) it is not possible anymore, if you care about XHTML validation. Before XHTML 1.0, there where two options to do that, one being the start attribute of the OL element, and the other, less obvious yet more powerful, a value attribute for the LI element.

Between the two options, I would rather go with the first. It’s the list that starts counting from one particular value, so the semantic information should belong to the list, not its items.

I understand the choice of removing those attributes. From an XML point of view a list that does not start from value 1 it is not the same list as the list that precedes it and that actually starts from value 1, as you need to have them in separate OL elements.

But this choice leaves my quite confused all the same. This, the fact of having an ordered list to start from a value different than 1, is a common typographic and logical need, so what I’m asking with this post is Was it really necessary to get rid of both attributes, since this behaviour isn’t replicable with any other technology we have at disposal, and since any alternative would lack semantic meaning?.

From an author perspective, my answer is no. My two cents: it would make more sense to retain the start attribute, so that this ability is somehow preserved, and add another attribute, such as role in XHTML 2 to semantically link lists that would otherwise be separated entities.


<ol role="toc">
	<li>item</li>
	<li>item</li>
	<li>item</li>
</ol>
<p>...</p>
<ol role="toc" start="4">
	<li>item</li>
	<li>item</li>
	<li>item</li>
</ol>

Does that make at least little sense to you too?

If you liked this article, you might want to read some more stuff Markup-related, or look for other content identified by the following keywords: , .

The discussion

The discussion is open. Feel free to post your thoughts; courtesy is required.

  • This is quite intriguing, but if we are thinking about would-be imaginary perfect future scenario (wow, that is a handful) then I would say that we don’t need a start attribute and a we need a smart role attribute.

    Let me explain: In your example we have 3 items in the first list thus the start attribute is set to 4 on the second list. But if the user (or a CMS editor - to add a real life perspective) would add another item to the first list, the start attribute in the second list has to be changed to 5.

    If the role attribute would be smart then the start attribute is not needed (can be non-required when for instance you want to start second list from let’s say 13) it should be enough for a browser rendering engine to link lists with the same role attribute and continue incremental numbering of element.

    Just my two cents… hopefully it will stir up the discussion a bit :)

  • I agree with Greg. `role` could provide a mechanism for the `start` attribute in order to be able to break the same list into many different parts without resetting the counter.

    Or also, it’d be nice if `start` could accept values like the #id of another element to grab from it the number of items already present in the list, in a way similar to:

    
    <ol id="myOrderedList">
    	<li>item</li>
    	<li>item</li>
    	<li>item</li>
    </ol>
    
    <ol start="myOrderedList">
    	<li>item</li>
    	<li>item</li>
    	<li>item</li>
    </ol>
     

Publish your remark

Required fields are marked by an asterisk (*). You can use some basic XHTML.

Some other juicy stuff

External resources

Just a bunch of articles I’ve came to bookmark that somehow are in topic with what you just read.