Is there a way to select the nth-child
or last-child
of a specific type of class among the same elements?
ie
if I use .small:last-child
or ul .small:last-child
that property will only affect the very last element of the second list. Is there a selector that I can use to select the last instance of small
in each list?
<ul>
<li class="small">List Item</li>
<li class="small">List Item</li>
<li class="medium">List Item</li>
<li class="large">List Item</li>
</ul>
<ul>
<li class="medium">List Item</li>
<li class="large">List Item</li>
<li class="small">List Item</li>
<li class="small">List Item</li>
</ul>
Please see fiddle CSS Line 72 for reference