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 17:18:32 +0000
Message-ID: <BAY109-F34874AD5CAEC5B15E02AAB4340@phx.gbl>
To: dbaron@dbaron.org, www-style@w3.org

Hi,

From: "L. David Baron" <dbaron@dbaron.org>
>On Saturday 2006-09-09 16:51 +0000, Simon Pieters wrote:
> > You're right. Here's a second shot:
> >
> >    :root, h ~ section:first-of-type { counter-reset:headers; }
> >    h::before { content:counters(headers, "."); 
>counter-increment:headers; }
>
>That won't work if some sections are nested within divs, e.g.:
>
><section>
>   <h>should be 1</h>
>   <div>
>     <section>
>       <h>should be 1.1</h>
>     </section>
>   </div>
>   <section>
>     <h>should be 1.2</h>
>   </section>
></section>

Yeah, and that's just the tip of the iceberg. For instance, if CSS counters 
should be able to create a correct outline of any HTML5 document then 
something else is needed. The heading/section outline algorighm[1] in HTML5 
is a lot more complicated than what can be expressed with CSS counters 
(since there are multiple sectioning elements, multiple heading elements, 
implied sections, and some heading elements are not part of the outline).

[1] http://whatwg.org/specs/web-apps/current-work/#headings

Regards,
Simon Pieters
Received on Saturday, 9 September 2006 17:18:49 GMT

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