W3C home > Mailing lists > Public > www-style@w3.org > July 2011

[css3-content] Structural pseudo-elements

From: Roland Steiner <rolandsteiner@google.com>
Date: Wed, 20 Jul 2011 18:29:25 +0900
Message-ID: <CACFPSpgYKXWGWy8_W2KfRbtYqjM1NPMe3196w8QGSVWG28kC2A@mail.gmail.com>
To: www-style@w3.org
Hi all,

reading through http://www.w3.org/TR/css3-content/#pseudo-elements, I'd have
a few questions and suggestions:

.) The spec mentions, as an aside, that 2 adjacent ::outside pseudo-elements
are "meaningless". To me foo::outside::outside would indicate an enclosing
pseudo-element for foo::outside, while foo::outside(2) indicates a 2nd layer
of enclosing elements. The effect is largely the same, except that in the
first case, foo::outside::outside inherits the style from foo::outside,
whereas in the case of foo:outside(2) the style is inherited from foo.

It seems the only reason to prohibit foo::outside::outside is that the
rendering order is ambiguous if you have both foo::outside::outside and
foo::outside(2) - but that's a different reason from being "meaningless".


.) By using structural pseudo-elements as defined in the spec, one can now
insert children within the element (::before and ::after) and wrap the
element within a new parent (::outside). What seems to be missing is the
ability to add siblings to the element. Pseudo-elements for this (let's call
them ::pred and ::succ for now) could IMHO be useful, esp. in cases where
you cannot add a wrapper (foo::outside::before instead of ::pred, and
foo::outside::after instead of ::succ) to simulate them, e.g., within lists
and tables. E.g.,

    ol.southpark li:last-child::succ { display: list-item; content: "???" }
    ol.southpark li:last-child::succ(2) { display: list-item; content:
"Profit!" }

to spruce up numbered lists.

As with ::outside, AFAICT ::succ::succ and ::succ(2) would be subtly
different in inheritance, but also ambiguous in rendering order.


- Roland
Received on Wednesday, 20 July 2011 09:30:09 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:42 GMT