CSS :first-child Selector

The :first-child CSS pseudo-class represents the first element among a group of sibling elements.

The :first-child selector allows you to target the first element immediately inside another element. 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 content.

The :first-child pseudo class means "if this element is the first child of its parent".

Example -