Reputation: 298
I have something like this:
<div id="someID">
<div class="text">
-----other html tags
</div>
<div class="text">
-----other html tags
</div>
<div class="text">
-----other html tags
</div>
</div>
And some CSS for the text div. It is possible to set different CSS for the second div with the class of text?
Upvotes: 3
Views: 6111
Reputation: 683
You can use the pseudo selector nth-child i.e div.text:nth-child(2)
Upvotes: 1
Reputation: 26317
You can easily do with with nth-child:
#someID .text:nth-child(2) {
background:red;
}
Demo: http://jsfiddle.net/P6FKf/
Upvotes: 4