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

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

From: Markus Ernst <derernst@gmx.ch>
Date: Mon, 11 Feb 2013 13:12:00 +0100
Message-ID: <5118E010.2080407@gmx.ch>
To: Øyvind Stenhaug <oyvinds@opera.com>
CC: www-style@w3.org
Am 11.02.2013 12:58 schrieb Øyvind Stenhaug:
> 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; }

That is cool! Having looked at the combinator selectors, I was not aware 
of this mechanism. It may be worth adding a reference to 3.2 in 
paragraph 13, Combinators.
Received on Monday, 11 February 2013 12:12:29 GMT

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