I'm looking for a CSS only (no JS) way to ignore hidden elements in nth-child counts. Is this possible?
I've got this HTML:
<div class="gallery-item"><img src="http://placehold.it/150x150"></div>
<div class="gallery-item"><img src="http://placehold.it/150x150"></div>
<div class="gallery-item empty"></div>
<div class="gallery-item"><img src="http://placehold.it/150x150"></div>
<div class="gallery-item empty"></div>
<div class="gallery-item"><img src="http://placehold.it/150x150"></div>
<div class="gallery-item"><img src="http://placehold.it/150x150"></div>
I'm trying to target every second gallery-item that is not empty, but this isn't working:
.gallery-item:not(.empty):nth-child(2n) {}
I don't want to use JS because this is a complex site that has many breakpoints and I don't want to add onresize listeners for something this basic.