W3C home > Mailing lists > Public > www-style@w3.org > June 2005

[CSS2.1] Counters

From: Staffan Mhln <staffan.mahlen@comhem.se>
Date: Wed, 15 Jun 2005 18:36:14 +0200
To: www-style@w3.org
Message-ID: <42B0751E.28382.1A692B@localhost>

I think there may be room for additional improvement of the counter
scope text. Is the number of the second div in following case clearly
defined and is the used value 1 or 2 if so (i think it may be defined
to be 1, but it should IMO be 2)?

div:before {content: counter(a_counter); counter-increment: 
  <div>First div</div>
  <div>Second div</div>
I think the first counter-level could be reset to 0 at the root
element, and other resets add a level of nesting.

When realising that CSS defines counters to act outside the
document-fragment they are defined for, things get rather unintuitive
for me. There were some changes to this between CSS 2 and CSS 2.1, 
where CSS 2 even specified that a counter defined its scope before
being reset, eg on previous siblings. When testing:
none of IE6, Mozilla or Opera8 gives the second li the number 2. The 
only reason i can imagine for wanting a counter to work "outside its 
document fragment" would be to cope with the case:
li:before {counter-reset: ..}
but that dosen't seem very likely.

IMHO it would be preferrable to change:
The scope of a counter starts at the first element in the document
that has a 'counter-reset' for that counter and includes the
element's descendants and its following siblings with their
descendants. However, it does not include any elements in the scope 
of a counter created by a 'counter-reset' on a later sibling of the 
element or by a later 'counter-reset' on the same element.
to something like:
The scope of all counters used in a document are reset to 0 at the 
root element unless explicitly set to a different value. Each element
that has 'counter-reset' for a counter creates a new scope that 
includes its descendants.
(I'm not sure if i missread the last sentence, how do you do multiple
counter-resets on the same element?)

Finally, since lists are easy to misstype and missunderstand, 
shouldn't the example use more modern markup that closes the

Received on Wednesday, 15 June 2005 16:36:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:18 UTC