Caffeinated Coder
Book an appointment
Lesson 16 · Motion and scale

Pseudo-classes and pseudo-elements

Some things a selector needs to know are not written in the tags: which item comes first, or which one the mouse is on. A pseudo-class (one colon, like :first-child or :hover) picks whole elements by that kind of fact. A pseudo-element (two colons, like ::before) names a part of an element, or a new box CSS adds to it. Watch three rules style one shopping list, and see that the ::before boxes are drawn but never join the DOM.

10 min10 steps5 questionsAdvanced
Fig 16 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.