I'm trying to devise a CSS selector that will select the last sibling in a parent container that does not have a particular class. In this example, I would want the button labeled "Two" to have red text.
.hidden {
display:none;
}
button:not(.hidden):last-of-type {
color:red;
}
<div>
<button>One</button>
<button>Two</button>
<button class="hidden">Three</button>
</div>
The way it works in this example, however, is that, to be selected, a button must be the last button in the list, AND it must not have the hidden class.
I want to select the last button that does not have the hidden class.
Is there a way I can accomplish this?