I would like to select following tags. Is this possible without changing HTML
structure ? DIV.first
elements are added dynamically so they may change. I need to style each last .first.bb
before .first.a
and the last one in #wrapper
which is already done.
html
<div id="wrapper">
<div class="first">first</div>
<div class="first bb">first second</div>
<div class="first bb">first second</div>
<div class="first bb">first second</div> <!-- <- need to select this -->
<div class="first a">first</div>
<div class="first a">first</div>
<div class="first a">first</div>
<div class="first bb">first second</div>
<div class="first bb">first second</div>
<div class="first bb">first second</div>
<div class="first bb">first second</div> <!-- <- need to select this -->
<div class="first a">first</div>
<div class="first a">first</div>
<div class="first a">first</div>
<div class="first bb">first second</div> <!-- <- need to select this -->
</div>
css
.first.bb:last-child {
color:red;
}
.first.bb + .first.a {
color:red;
}