I've been struggling a long tome to figure this one out. Basically, I'll need to find the last child element of some element, which does neither have a specified class property, nor a specified style property.
I have tried everything that has been suggested here, without success.
What I want to achieve, is to make sure the last element inside of a "toolbar" have border-radius, such as can be seen here - https://home.gaiasoul.com/hyper-ide (to right corner)
However, every now and then, one of my buttons are hidden, because they're not supposed to be visible, since they're "disabled" for some reasons. At which point I can't simply use last-child selector, since this might select a button that is not visible.
I cannot use JavaScript, and absolutely not any jQuery.
Example of HTML where it should not select the last-child.
<div class="strip">
<button>1. visible</button>
<button>2. visible</button>
<button class="hide">3. HIDDEN</button>
</div>
Basically, I want a selector that will find the last child element of "strip" from above, but not if it's invisible, which is the case for the last element above.
The reason why my example looks good, is because it does not have an invisible button. I want to accomplish the same, also if there was an invisible button as my last element ...
I have tried nth-last-child with a :not, as suggested in one of the other questions here (which is similar). Here is my current (relevant) CSS, which obviously doesn't work.
.strip {
display: flex;
}
.strip>* {
border: solid 1px var(--border-color);
border-radius: 0;
border-left-style: none;
}
.strip>*:first-child {
border-top-left-radius: var(--border-radius);
border-bottom-left-radius: var(--border-radius);
border-left-style: solid;
}
.strip>*:last-child {
border-top-right-radius: var(--border-radius);
border-bottom-right-radius: var(--border-radius);
}
I have tried
.strip>*:nth-last-child(1 of :not(.hide))
And all sorts of :not permutations, but it doesn't seem to work. Can it even be done ...?