CSS units
A CSS relative unit. 1rem equals the root element's (html) font size. Unlike em, rem is not affected by nesting — it is consistent throughout the page.
Understanding CSS units in HTML & CSS
What it does: If the paragraph's font size is 16px, padding: 1.5em = 24px. If the font size changes, the padding scales too. 2px is always 2 pixels. Unlike em or rem, px does not scale with the font size or viewport size. em multiplies by the current font size. 2em on 20px = 2 × 20px = 40px. It is relative to the element's own font size. vh (viewport height) is relative to the browser window. 100vh = the full visible height of the viewport. There must be no space between the number and its unit: 16px is valid, 16 px is invalid.
Common mistakes: A number without a unit is invalid CSS (except for 0). It should be font-size: 16px; with the px unit. There must be no space between the number and the unit. It should be font-size: 2em; not font-size: 2 em;.
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 43–52) and word search (Modules 43–63).
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
remFill in the Blanks
Spot the Error
Student with a class code? Join your class →