W3C home > Mailing lists > Public > www-style@w3.org > August 2007

Re: Reverse numbering of ordered lists

From: Pascal Germroth <pascal@germroth.name>
Date: Mon, 06 Aug 2007 10:55:58 +0200
Message-ID: <46B6E21E.2080209@germroth.name>
To: Peter Moulder <Peter.Moulder@infotech.monash.edu.au>
CC: Benjamin Kudria <ben@kudria.net>, www-style@w3.org

>> What is the best way to construct an ordered list such that the numbering
>> countd *down*...i.e., 3. 2. 1.
>>
>> Is this even possible?
> 
> http://www.w3.org/TR/CSS21/generate.html#propdef-counter-increment looks
> promising.  "Zero and negative integers are allowed."

But you would have to count all the items before rendering the first (or
get 0, -1, -2, -3) and this does, afaik, not yet work automatically.

It would need something like

ul {
	counter-reset: name count(li);
}

li::before {
	content: counter(name) ".";
	counter-increment: name -1;
}

To produce 3, 2, 1

But this would require lookahead which somebody does not like...

It was, iirc, the reason why CSS-selectors would not get "predicates"
like in XPath: //ul[li/a] "select every ul which has an li with an a in
it" could be ul:with(li > a)

Everything would be so much easier, besides the fact that :only-child
already requires some lookahead (at least up to the next tag)



-- 
pascal
Received on Monday, 6 August 2007 09:06:44 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:52 GMT