W3C home > Mailing lists > Public > public-html@w3.org > September 2009

Re: section/article grouping and CSS [was: Re: what is dt?]

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 23 Sep 2009 10:47:26 -0500
Message-ID: <dd0fbad0909230847v34d22c84lfd3505f540b40394@mail.gmail.com>
To: Jim Jewett <jimjjewett@gmail.com>
Cc: HTML WG Public List <public-html@w3.org>
On Wed, Sep 23, 2009 at 10:39 AM, Jim Jewett <jimjjewett@gmail.com> wrote:
> In http://lists.w3.org/Archives/Public/public-html/2009Sep/0735.html
> Jeremy Keith wrote:
>
>> Here is some CSS from a project I'm currently working on: ...
>
>> h4,
>> section h3, article h3,
>> section section h2, article article h2,
>> section article h2, article section h2,
>> section section section h1, article article article h1,
>> section section article h1, article article section h1,
>> section article article h1, article section section h1 {
>
> This (and later rules) misses cases like "article section article",
> and the use of descendent instead of child means that higher level
> rules will be applied instead.
>
> One HTMLWG answer would be to declare some sort of subclass
> relationship that could refer to any of {section, article, anything
> else?}.  Perhaps better would be extending selectors, but that should
> be done by CSS.
>
> My personal opinion is that it would be even better not to do this --
> go ahead and use knowledge about your own site, perhaps by starting
> with an ID, or using a class.
>
> Except -- this seems to be what the outline algorithm (and the H1
> everywhere) actually does.  Is this complexity enough to consider
> simplifying that in some way?  (Maybe resetting to h2 when the type of
> sectioning element changes, regardless of depth?)

The best way to address this is with a :heading(n) pseudoclass in CSS,
which matches a heading with the specified level, based on the host
language's own outlining algorithm.  Bring it up on www-style.  ^_^

(Another option is an :any() pseudoclass, which takes a list of
selectors and matches an element which matches any of the argument
selectors.  So you could do ":any(section,article)
:any(section,article) h2" rather than having to write four separate
rules to deal with each combination.  I've needed this myself in
designs previously.)

~TJ
Received on Wednesday, 23 September 2009 15:48:21 UTC

This archive was generated by hypermail 2.3.1 : Monday, 29 September 2014 09:39:08 UTC