I am trying to customize a class element (appearing more than once in the DOM) by index or iteration, strictly using CSS.
I know several different ways to achieve this: I could throw an element into an array and get the specific index of the specified element (Javascript). I can mark the item I'm trying to set using #ID. I could refine the target element by specifying the attribute ( .element[href="link"] ). The :first-child and :last-child pseudo :last-child are intended only for children of this (parent) element (Duh!).
Example: I have a .class that appears 5 times in my DOM and I want to affect the CSS 3rd properties of the iteration of this .class element.
I wish there was a .element:index-3. pseudo- .element:index-3. Perhaps there is something that allows you to do just that.
javascript dom html css css-selectors
Justin ward
source share