The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › CSS › Getting nth-of-type to work for non-siblings?
So basically what I want is something along these lines. It’s a simple concept, and I’m wondering if there’s any sort of way to work around this issue? Perhaps even with a little js?
https://codepen.io/soppysopbat/pen/NmraGO
nth- selectors require the elements to be siblings…..and only select elements…so you can’t select nth-of-class for instance.
nth-
nth-of-class
Anything more elaborate than that requires JS
https://stackoverflow.com/questions/5545649/can-i-combine-nth-child-or-nth-of-type-with-an-arbitrary-selector
Yeah, I saw that before, but Idk how to make the js for this code. His code is different than mine.