Is there a way to change the text color of 5
to red?
I've tried some solutions, but nothing seems to work. Any ideas on how to fix this issue?
Please Note: This example is just a simplified version of the actual problem, so the structure and quantity of child elements may vary.
#parent>.child:last-of-type {
color: red;
}
<div id="parent">
<span class="child">1</span><br>
<a>2</a><br>
<span class="child">3</span><br>
<a>4</a><br>
<span class="child">5</span><br>
<span>6</span>
</div>