On Dec 6, 2010, at 12:59 PM, Dave Solko wrote:

> I'm trying to apply :first-child to an element with a class. It only needs to 
> work in safari (intranet). I'm using Joomla, so changing the html isn't 
> really an option. Can it be done?
> 
> I've been trying variations on:
> .leading:first-child {
> border-top: 1px solid #ccc;
> border-top-left-radius: 8px;
> border-top-right-radius: 8px;
> }
> 
> <code>
> ...
> <div class="content">
>      <div class="description">
>            <h1>resources</h1>
>      </div>
>      <div class="leading">
>            <h1>foo</h1>
>            <p>lorem ipsum dolor sit amet...</p>
>      </div>
>      <div class="leading">
>            <h1>bar</h1>
>            <p>lorem ipsum dolor sit amet...</p>
>      </div>
> 
> </div>

In your case, the div with  class .leading is definitely not the first-child 
(it is the second, third, ... child of div.content).

And remember: those structural pseudo-classes count *elements*, then checks if 
they have a class, etc.

Given the document structure above, maybe .description + .leading { background: 
red } ?

Philippe
---
Philippe Wittenbergh
http://l-c-n.com/





______________________________________________________________________
css-discuss [[email protected]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to