I have this code example
<ul>
<li class="list">test1</li>
<li class="list">test2</li>
<li class="list">test3</li>
<li>test4</li>
</ul>
Is there is a way to get the last element with class="list"?
It's exactly like this question How do I select the "last child" with a specific class name in CSS? but there is a trick. I can't modify the html code so while this question's solution is good it doesn't work in this case.
Thanks!
PS: I can't use jquery or javascript. Its pure CSS here.
PS2: The element's amount is not always the same