W3C home > Mailing lists > Public > www-style@w3.org > April 2013

[selectors4] siblings and pseudo-elements

From: Dario De Bastiani <dario.debastiani@gmail.com>
Date: Fri, 22 Mar 2013 13:22:54 +0000
Message-ID: <CABNnbwn_BTRqkfSOxyEdTR+TOEY6=Qh6mmE0PG5ZFskqQ_cYZg@mail.gmail.com>
To: www-style@w3.org
Hi,

this is the first email I send to a w3c list - I read the instructions but
if I am doing anything wrong please do tell me.

I'd like to suggest 2 additions to selectors level 4:

 1) **previous-sibling** and **preceding-sibling** combinators.
These would be complementary to the next-sibling and following-sibling
combinators.
I have tried to search the archives for any discussion that could shed
light on why they have never been implemented, but couldn't find anything
relevant.

One use case for these could be labels preceding inputs that need to be
styled differently than those afterwards.

**sibling** and **neighboring-siblings** combinators could also be added
as syntactic sugar in place of `preceding-sibling, following-sibling` and
`previous-sibling, next-sibling`.

 2) allow more than a single ::before and ::after pseudo-element.
This could look something like **::before(x)**, with x as a number and
::before(0) being the same as ::before.
::before(1) would create a new pseudo-element after ::before(0), and so on.

The main problem I see with limiting the number of pseudo-elements, is that
sometimes they are both already used up: see for example [this float
clearing technique](http://nicolasgallagher.com/micro-clearfix-hack/).
Using code like that currently makes adding further styling via a new
pseudo-element impossible.
Received on Thursday, 4 April 2013 10:01:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:10 UTC