Re: [CSS21] Possible counters() limitation?

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 UTC