Skip to main content

Which pseudo-classes do you know?

Pseudo-classes fall into groups. The main ones worth knowing:

1) Element states :hover, :active, :focus, :visited, :link, :focus-visible, :focus-within, :disabled, :checked, :required, :valid, :invalid

2) Structural pseudo-classes :first-child, :last-child, :nth-child(), :nth-of-type(), :first-of-type, :last-of-type, :only-child, :only-of-type, :nth-last-child()

3) Logical and utility :not(), :is(), :where(), :has()

4) Other useful ones :root, :empty, :target, :lang(), :fullscreen, :scope

This is not a complete list, but these are the most commonly used pseudo-classes in modern CSS in practice.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.