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

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 UTC