Re: [CSS2.1] Counters

On Wednesday 2005-06-15 18:36 +0200, Staffan Måhlén wrote:
> 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.

The rationale for this is to allow numbering of Hn elements using
counters.

> 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.
> "

This would not only break Hn numbering, but would also cause lists
numbered using counters() to all have an additional "0." at the
beginning of the number, e.g. "0.10.3" instead of "10.3".

> (I'm not sure if i missread the last sentence, how do you do multiple
> counter-resets on the same element?)

counter-reset: c 2 c 4;

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

Probably.

-David

-- 
L. David Baron                                <URL: http://dbaron.org/ >
          Technical Lead, Layout & CSS, The Mozilla Foundation

Received on Wednesday, 15 June 2005 16:42:31 UTC