On Dec 5, 2010, at 11:18 PM, Philippe Wittenbergh wrote:


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/


Then perhaps I should rephrase the question. Is there any way, given the existing HTML to address the first <div class="leading"> independently of the others? (in reality, there's 4 'leadings')

Dave Solko
Pixel Alchemy
d...@pixelalchemy.com
513.300.2165



______________________________________________________________________
css-discuss [cs...@lists.css-discuss.org]
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