Re: CSS3 missing selector

On Thu, Mar 26, 2009 at 9:42 PM, James Elmore <James.Elmore@cox.net> wrote:
>
> On Mar 26, 2009, at 11:27 AM, Dave Smith wrote:
>
>>>
>>> What if "::content" was used in conjuction with a non heading element
>>> (like p::content)?
>>
>> That should be a CSS error, as I can only see heading elements benefitting
>> from ::content or ::content-parent (::section). There are no other
>> elements,
>> I can think of, that would practically benefit from them.
>
>> Dave
>
> There are other elements which have titles / headings, such as tables. I
> believe there was some discussion about adding them to images and possibly
> even generic blocks in HTML5, but I don't know if anything came out of that
> discussion. Currently, HTML does not support combining heading elements and
> the content they are associated with, but I like the idea. Keeping headings
> / titles / figure captions / image labels, etc. together would be useful for
> authors and (I believe) would simplify the job of CSS developers in the
> future.
I think you are speaking about the figure and legend elements [1].
There isn't support for them in browsers right now, but are included
in the HTML5 spec. The good thing about these elements is that they
don't really require too much special treatment from UA's: you could
use them right now, and use CSS to make sure they render as intended
(you'd need a bit of JS for them to work on IE, but it's quite
trivial). Furthermore, these are easily selectable via current CSS,
with selectors like
figure { ... } and
figure>legend:first-of-type { ... }

> I'm not sure if the ::content pseudo element should report an error or a
> null (empty) when used on non heading elements, simply because I can see
> that it might be useful to add headings to many different element types in
> the future.
Honestly, I don't really like that proposal too much, but if it was
finally included in CSS, then I'd expect any nonsensical ::content to
just match nothing, which is the easiest approach to spec, to evolve
over time, and to understand when learning CSS.

>
> </James>
>
>

[1] http://www.whatwg.org/specs/web-apps/current-work/#the-figure-element

Regards,
Eduard Pascual

Received on Thursday, 26 March 2009 22:31:04 UTC