The : nth -of- type selector allows you select one or more elements. Unfortunately, there is no way (at least none I know of) to select nth -of- type of a class , since nth -of- class doesnt exist. You will probably have to . Can I combine : nth -child() or : nth -of- type () with an arbitrary. CSSselector :first-of- type with class name?
I recently ran into a situation where I wanted to select the nth.
CSS Select nth element with class. I though a selector like li. Using : nth -child(8) it allows you to specifically choose to change only the 8th.
Using the : nth -of- type () allows you to select a specific child within a type of . The nth -child() and nth -of- type () selectors are “structural” pseudo- classes , which are classes that allow us to select elements based on . The pseudo class :first-of- type does exist, but it is limited. It is a special case of the : nth -of- type () pseudo class. From the spec (emphasis mine):.
Description: Selects all elements that are the nth child of their parent in relation to siblings. It does not take the class negation into account when .