CSS3 selector to find the 2nd div of the same class

Posted by mpeters on Stack Overflow See other posts from Stack Overflow or by mpeters
Published on 2008-11-20T17:05:20Z Indexed on 2010/05/10 3:08 UTC
Read the original article Hit count: 185

Filed under:
|

I need a CSS selector that can find the 2nd div of 2 that has the same class. I've looked at nth-child() but it's not what I want since I can't see a way to further clarify what class I want. These 2 divs will be siblings in the document if that helps.

My HTML looks something like this:

<div class="foo">...</div>
<div class="bar">...</div>
<div class="baz">...</div>
<div class="bar">...</div>

And I want the 2nd div.bar (or the last div.bar would work too).

© Stack Overflow or respective owner

Related posts about css

Related posts about css3