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

Re: [css4-selectors] Proposal: Previous sibling combinator

From: Øyvind Stenhaug <oyvinds@opera.com>
Date: Mon, 11 Feb 2013 12:58:55 +0100
To: "Markus Ernst" <derernst@gmx.ch>
Cc: www-style@w3.org
Message-ID: <op.wscbkhs0bunlto@oyvinds-desktop>
On Mon, 11 Feb 2013 12:22:12 +0100, Markus Ernst <derernst@gmx.ch> wrote:


> <p>My favorite fruits:</p>
> <ul>
>    <li>Pear</li>
>    <li>Banana</li>
> </ul>
>
> It is most often convenient to style the p element with a top and bottom  
> margin, but you want the ul to follow immediately. It would be very cool  
> to have a Previous sibling selector in this case (I use the minus sign  
> for the example, which is possibly not the best choice):
>
> p { margin: 0.7em 0; }
> p - ul { margin-bottom: 0; }

The current draft already proposes a mechanism for doing this kind of  
stuff:

!p + ul { margin-bottom: 0; }

http://www.w3.org/TR/selectors4/#subject
http://dev.w3.org/csswg/selectors4/#subject

-- 
Øyvind Stenhaug
Opera Software ASA
Received on Monday, 11 February 2013 11:59:26 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:05 GMT