See ...
div .p:nth-of-type(2) {
font-weight: bold;
}
DIV 1
<div div="div1">
<p class="p">p1</p>
<p>p2</p>
<p>p3</p>
<p class="p">p4</p>
</div>
DIV 2
<div id="div2">
<p class="p">p1</p>
<p>p2</p>
<p>p3</p>
<p class="p">p4</p>
</div>
In the example above, I want to select the second element of the parent (.p) class of a parent (div), and that is not the result.
if I make use of nth-of-type(1
) it works, which for me translated would be, select the first element of the parent type of a parent (div). But why nth-of-type(2)
does not go there for the fourth paragraph of both divs, giving the bold effect ..