I see! 

In the entire time I thought this applies to any first child of p, and so are 
for the first h2 and first dd in any give page if first-child is declared.

p:first-child

<p> The last P before the note.</p>
<div class="note">
   <h2> Note </h2>
   <p> The first P inside the note.</p>
</div>


How embarrassing!  I'd been using first-child for over a year, probably much 
longer mostly for li, but only recently started using it for heading and dd, 
and  I found it doesn't work.

Thank you!

tee

On Mar 6, 2011, at 2:34 AM, David Dorward wrote:

> Because those elements are not the first child element in their respective 
> containers.
> 
> 
> On 6 Mar 2011, at 10:03, tee wrote:
> 
>> http://jsbin.com/apate4/9/
>> 
>> dt, dd { border-top:1px solid #555;float:left }
>> dt:first-child {border-top:0}
>>   dd:first-child {border-top:0}
> 
> <!-- Container --> <dl> 
> <!-- 1st Child -->   <dt>test</dt>
> <!-- 2nd Child -->   <dd>There should be no border top here</dd> 
> 
> Since the <dd> is not the first child, a selector using :first-child won't 
> apply.
> 
> 
>> h2, p {background:#ddd;padding:15px;margin:5px}
>> h2:first-child,p:first-child  {background:#95B26B} p/s. I tried declared the 
>> two individually as I thought maybe they can't be grouped, but it makes no 
>> differences.
> 
> <!-- Container --> <body> 
> <!-- 1st Child -->   <dl> ... </dl>
> <!-- 2nd Child -->   <h2>Heading 2 this is the first-child and the bg color 
> should be in Olive.</h2> 
> 
> Ditto.
> 
> -- 
> David Dorward
> http://dorward.me.uk



*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: memberh...@webstandardsgroup.org
*******************************************************************

Reply via email to