Skip to content

QuizNot attempted

rem vs em

Root font-size is 16px. A .parent { font-size: 1.5em } sits inside a 24px container. What is .child { font-size: 1.5em } inside .parent, and what would 1.5rem be?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • 54px vs 24px
  • em on font-size is relative to the parent's font-size and compounds: .parent = 24 × 1.5 = 36, .child = 36 × 1.5 = 54.
  • rem always uses the root: 16 × 1.5 = 24.
  • Not 36px vs 24px: 36 is .parent, it forgets the second multiplication.
  • Not 24px vs 24px: that treats em like rem.
  • Not 54px vs 36px: rem ignores the parent chain entirely, so it cannot be 36.
  • Use rem for a consistent type scale, em for things that should scale with their component.