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

RE: [CSS21] Possible counters() limitation?

From: Simon Pieters <zcorpan@hotmail.com>
Date: Sat, 09 Sep 2006 16:38:01 +0000
Message-ID: <BAY109-F203B95F98F69FFF78BF891B4340@phx.gbl>
To: annevk@opera.com, www-style@w3.org

Hi,

From: "Anne van Kesteren" <annevk@opera.com>
>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

I believe this should work:

   :root, h + section { counter-reset:headers; }
   h::before { content:counters(headers, "."); counter-increment:headers; }

Regards,
Simon Pieters
Received on Saturday, 9 September 2006 16:38:22 GMT

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