I'm looking for help with using the nth-child CSS selector. If you take a look at my HTML...
<div id="report">
<div class="a">A</div>
<div class="a">A</div>
<div class="a">A</div>
<div class="a">A</div>
<div class="b">B</div>
<div class="a">A</div>
<div class="a">A</div>
<div class="a">A</div>
<div class="a">A</div>
<div class="b">B</div>
<div class="a">A</div>
<div class="a">A</div>
<div class="a">A</div>
</div>
...I have a row of letters like this:
AAAABAAAABAAA
I want to only show the first B and hide the others, however I cannot seem to select the classes as I expect. When I try to use:
.b:nth-child(1){
display: block;
}
.b:nth-child(n+2){
display: none;
}
It doesn't work and I have to select it using (5) to just get the first B.
Help would be greatly appreciated.
JSFiddle: http://jsfiddle.net/SrM9T/1/