- From: Staffan Måhlén <staffan.mahlen@comhem.se>
- Date: Wed, 15 Jun 2005 18:36:14 +0200
- To: www-style@w3.org
Hi, 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: a_counter} <body> <div>First div</div> <div>Second div</div> </body> 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: <ol> <li>First</li> </ol> <li>Outside</li> 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: http://www.w3.org/TR/2005/WD-CSS21-20050613/generate.html#scope " 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 elements? /Staffan
Received on Wednesday, 15 June 2005 16:36:15 UTC