W3C home > Mailing lists > Public > www-style@w3.org > March 2016

[css-lists] Allow counter() to be used where numeric values are expected

From: Mark Crutch <mark.crutch@gmail.com>
Date: Wed, 02 Mar 2016 13:32:28 +0000
Message-ID: <CANwVQOdbo3+BYwAY=APcz=qkyPJTHvDnTbwEONujYzb9x0nimw@mail.gmail.com>
To: www-style@w3.org
I would like to put forward a suggestion to the WG to extend the scope of
the counter() function to allow it to be used in a CSS property wherever a
numeric value is allowed. This would only apply to counters of the
"decimal" type.

My primary reason for wanting this possibility is to do with CSS3 flexbox
and the ordering of children therein using the "order" property. Currently
"order" computes to 0, meaning that reordering a single child into the
middle of a set requires all the siblings to also be given a specific
"order" value. Without doing this, any positive value for "order" causes
the element to jump to the end of the list of siblings as all of the others
have an implicit value of 0. See this example in which the intention is to
move item 1 to be between items 3 & 4 by giving it an explicit order value,
but the outcome is that the first item is moved to the end:

http://codepen.io/anon/pen/yOyvdJ


By allowing counter() to be used in the "order" property, it would be
possible to automatically give each child an ascending value. This would
then meand that explicitly setting the property on one of them would move
the child as expected. See this example for how the syntax might work in
such a scenario:

http://codepen.io/anon/pen/BKyYeg


I could also imagine that extending the scope of counter() in this way
would be useful in a number of other ways, particularly when combined with
the calc() function to allow the counter value to be scaled to larger
numbers.



Mark


-- 
*The Greys*, *Elvie* and *Monsters, Inked* webcomics

Website      http://www.peppertop.com/
Facebook   http://facebook.com/PeppertopComics
Twitter        https://twitter.com/PeppertopComics
Received on Friday, 4 March 2016 14:23:05 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:01 UTC