Pseudo-class

noun

say it: “SOO-doh klas” /ˈsuːdoʊ klæs/

A word after a colon that adds a condition to a selector, such as a state (hovered, focused, checked) or a position (first, every other). li:hover is read "li when hovered".

What is a pseudo-class?

A pseudo-class styles an element in a certain state or position, like hovered, focused or first in a list. It starts with one colon.

button:hover { background: darkblue; }
li:first-child { font-weight: bold; }

In a sentence

  • “I used the pseudo-class :nth-child(odd) to shade every other row of the playlist.”

Level: Apprentice · More CSS terms at this level

Updated