I think, it's doesn't work but h2 is not a first child element in
parent element (div).

<div>
        <p>This is the first child</p><!-- first child element -->
        <h2>First header</h2><!-- second child element-->
        <p>A paragraph</p>
        <h2>Second header</h2>
        <p>A paragraph</p>
</div>

2011/3/10 tee <weblis...@gmail.com>:
>
> On Mar 6, 2011, at 4:52 PM, Rob Crowther wrote:
>
>> On 06/03/11 20:22, tee wrote:
>>> but I can never get h2:first-child works
>>>
>> Here's an example, specifically using h2 elements since you mentioned them:
>>
>> http://www.boogdesign.com/examples/css3/first-child.html
>>
>> By default, every element has a blue border, but any element which is a 
>> :first-child has a red border:
>>
>> :first-child {
>>    border: 1px solid red;
>> }
>>
>> In addition, h2 elements which are children of #content and first-child 
>> within their parent have white text on a black background:
>>
>> #content h2:first-child {
>>    color: #fff;
>>    background: #000;
>> }
>
> Indeed. I'd just got a chance to check one of the sites that the h2 is used 
> for accordion title and still doesn't work. But if I bring it to JSBin 
> without other code, it works. So something must be conflicting with it.
>
> Thanks!
>
> tee
>
> *******************************************************************
> List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
> Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
> Help: memberh...@webstandardsgroup.org
> *******************************************************************
>
>


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

Reply via email to