RE: [CSS21] Possible counters() limitation?

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 UTC