Possible Duplicate:
How do I select the “last child” with a specific class name in CSS?
As the title says, i want to adress css rules to the last element of a certain type which has a certain class. The following code works perfectly:
div:last-of-type { margin-right:0; }
but i want something like
div.class:last-of-type { margin-right:0; }
How to do this ?
Unfortunately finding the last .class
is not possible with last-of-type
.
Edit:
To actually add something constructive to this answer, you could fallback to JavaScript to locate this selector, or revise your markup/CSS. Whilst I have found myself in the situation that last-of-type
for a class selector would be useful, it's nothing that cannot be worked around with a little more thought.