W3C home > Mailing lists > Public > www-style@w3.org > November 2006

Re: [CSS21] Possible counters() limitation?

From: Paul Sawyer <pauldsawyer@yahoo.com>
Date: Tue, 7 Nov 2006 15:07:50 -0500
Message-ID: <001901c702a8$67b56190$9459a845@paulsdesktop>
To: <www-style@w3.org>

On Tuesday 2006-11-06 L. David Baron wrote:
>On Saturday 2006-09-09 14:53 +0200, Anne van Kesteren wrote:
>> It seems that the counters() construct doesn't really address the use 
>> case
>> of sections and headers. With a structure such as:
>>
>>   <section>
>>    <h>LEVEL 1</h>
>>    <section>
>>     <h>LEVEL 2</h>
>>    </section>
>>    <section>
>>     <h>LEVEL 2</h>
>>    </section>
>>   </section>
>>
>> ... I can't really find the a way to get an outline such as:
>>
>>   1.  LEVEL 1
>>   1.1 LEVEL 2
>>   1.2 LEVEL 2
>
>
>We discussed this at our meeting in Mountain View last month, but
>decided that addressing this seems to require either (a) new
>features or (b) breaking the ability of counter() and counters() to
>handle ol/li nesting or h1/h2/h3 numbering.  We therefore decided to
>postpone trying to address this issue until css3.
>
>-David



I agree with David's point that new features are required to support this 
behavior without breaking anything. You could achieve this behavior without 
making any changes to the existing counter model by adding one property, 
which I would call "counter-nested-reset". counter-nested-reset would 
function very similarly to counter-reset except that the reset (and the 
creation of a new instance of the counter) would only be applied when a 
counter-nested-reset was encountered for the first time at a deeper level of 
nesting.



The following style sheet would then produce the desired behavior:

section {counter-nested-reset: item; counter-increment: item}
h:before {content: counters(item, ".") " "}


I am writing a technical publishing application. Hierarchically numbered 
sections like this are very common in technical publishing. It would be 
great if CSS2 could support it.

Paul Sawyer
Received on Tuesday, 7 November 2006 20:14:53 GMT

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