Pseudo-classes

A pseudo-class targets a state of an element or its position, with a single colon: :hover (hover), :focus and :focus-visible (focus), :active, :disabled, :first-child, :nth-child(). They let you style interaction without JavaScript.

Example

a:hover { text-decoration: underline; }
li:nth-child(odd) { background: #eee; }

Related concepts

The whole glossary