Pseudo-classes
A keyword added after a selector with a colon that targets an element based on its state or position, e.g. :hover or :focus.
Understanding Pseudo-classes in HTML & CSS
What it does: :last-child selects the final child element within its parent container. Pseudo-classes use a colon (:). A dot (.) selects a class attribute, not a state. :hover responds to mouse position. :focus responds to keyboard or click focus. :first-child targets only the first child of a parent, not all matching elements. :visited applies to links in the browser's history. :active applies during a click. a:hover is a pseudo-class selector that activates on mouse-over. input:focus applies whenever the input element is focused by the user.
Common mistakes: Pseudo-classes use a colon, not a dot. a.hover tries to match an element with class='hover'. The correct selector is a:hover. CSS declarations need a colon between the property and value. It should be border: 2px solid blue; not border 2px solid blue;.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 31–41) and word search (Modules 21–41).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
pseudo-classFill in the Blanks
Spot the Error
Student with a class code? Join your class →