Previous Message
Next Message

[css-d] Aha! Child and adjacent selector madness

Sent by Austin Govella on 26 September 2002 18:06


>> If I have a <div id="entry"> and then a <p>, then the folowing should 
>> work,
>>  right?
>>
>> div#entry + p { text-indent: 0em; }
>
>    Right, assuming that the element are in fact siblings.  In browsers 
> that support adjacent-sibling selectors, at any rate.  So the above would 
> match the 'p' element in:
>
>    <div id="entry">...</div>
>    <p>...</p>

I have

<div id="entry>
<p>...</p>
</div>

So, I actually should've used a child selector. Child elements are nested 
inside their parent elements. So:

div#entry > p

And then I only wanted the first child element, so:

div#entry > p:first-child

(posted for those who might be curious)

Many thanks for the clarification, Eric.

--
Austin
Previous Message
Next Message

Message thread: