W3C home > Mailing lists > Public > www-style@w3.org > March 2009

Re: CSS3 missing selector

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 23 Mar 2009 12:31:10 -0500
Message-ID: <dd0fbad0903231031v33e4b629i785139430945bdee@mail.gmail.com>
To: Eduard Pascual <herenvardo@gmail.com>
Cc: Giovanni Campagna <scampa.giovanni@gmail.com>, Brad Kemper <brad.kemper@gmail.com>, Dave Smith <smithd7@tcd.ie>, www-style@w3.org
On Mon, Mar 23, 2009 at 11:39 AM, Eduard Pascual <herenvardo@gmail.com> wrote:
> I'd like to point out that this is a need, rather than a convenience.
> I already gave some explanation of this on my original proposal, but
> to summarize: try to come with a selector that matches any 3rd-level
> heading on a HTML5 document (it is achievable). Once you get it (if
> you get it right), take a look at what you have and think if something
> like :heading(3) or any other direct notation wouldn't make the whole
> language more usable.

FWIW, Eduard is completely correct here.  We *need* a :heading(n)
pseudoclass if we're going to benefit at all from the HTML sectioning

A :section(n) pseudoclass is only slightly less necessary.  This
actually *cannot* be achieved in vanilla CSS, because linear content
can implicitly contain nested sections, and the header which
establishes a section can actually come after the start of the

Frex, in this example, a linear progression of elements creates a
nested series of sections:


The section tree produced is equivalent to the one produced by the following:


For another example, take this markup:


The <h1> is the header for the entire section, even though content
precedes it.  Thus, even if you can craft a selector that reliably
selects headers of a particular heading level, you can't use that
selector to then style the contents of the section that header
corresponds to.  A simply "{header} ~ *" won't work, because you have
to hit previous content as well.

There are some problems with the :section() pseudoclass, though.
Namely, it can't decide whether it wants to be a pseudoclass or a
pseudoelement.  To be precise, it's *logically unable* to decide that,
because sometimes it has to be a pseudoclass (when an explicit
<section> element exists), and sometimes it has to be a pseudoelement
(when sectioning is implicit).  I'm not sure whether this will be a
significant issue in implementation or not.

Received on Monday, 23 March 2009 17:31:50 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:25 UTC