CSS :nth-of-type() Selector

The :nth-of-type selector allows you select one or more elements based on their source order, according to a formula. It is defined in the CSS Selectors Level 3 spec as a “structural pseudo-class”, meaning it is used to style content based on its relationship with parent and sibling elements.

The :nth-of-type() is a CSS pseudo-class selector that allows you to select elements of the same type based on their index (source order) inside their container.

The :nth-of-type(n) selector matches every element that is the nth child, of a particular type, of its parent.

Example -