CSS Tutorial

The language for styling web pages.

CSS Pseudo-classes

CSS Pseudo-classes

A pseudo-class is used to define a special state of an element, such as when a user mouses over it, or when a link has been visited.

Common Pseudo-classes:

Pseudo-classSelects
:hoverMouse over element
:activeClicked element
:focusFocused element
:first-childFirst child element
:last-childLast child element
:nth-child(n)nth child element
:not(selector)Not matching selector
:checkedChecked input

Try It Yourself

Edit the code below and click Run to see the result live.

Source Code
Result
Topics