I have a list of tags with 2 possible classes: P1 and P2. I want to apply CSS to the first item of each class. It doesn't work neither in my project nor in the fiddle
Why is that?
.A>.B>.C>.P1:first-child {
font-weight: bold;
}
.A>.B>.C>.P2:first-child {
font-style: italic;
}
;
<div class="A">
<div class="B">
<div class="C">
<p class='P1'>
"JAJA P1"
</p>
<p class='P1'>
"JAJA P1"
</p>
<p class='P2'>
"JAJA P2"
</p>
<p class='P2'>
"JAJA P2"
</p>
</div>
</div>
</div>