I have 5 divs.
<div class="itemA">First of Item A</div>
<div class="itemA"></div>
<div class="itemB">First of Item B</div>
<div class="itemB"></div>
<div class="itemB"></div>
I want to apply the background-color: #ccc
for the first element of itemA, and for the first element of ItemB. This just the only solution works for me, because i'm aplying this css by a part of an another solution.
So, here is my CSS:
.itemA, .itemB{
width: 200px;
height: 30px;
border-top: 2px solid #fff;
background-color: #000;
}
.itemA:first-child,
.itemB:first-child{
background-color: #ccc;
}
And here is the expectations:
Unexpected (actual working): - Gray - Black - Black - Black - Black
Expected: - Gray - Black - Gray - Black - Black
What Am I doing bad, what is the solution for this problem?