Module lessons (3/4)
CSS Units: px, %, em, rem, ch, svh & dvh
Choose rem for scalable UI, ch for prose measure, percentages for fluidity, and svh/dvh to dodge mobile viewport bugs.
What you'll learn in this lesson
- Choose the right CSS unit for every role:
px,rem,em,%,ch, and viewport unitsvw/svh/dvh. - Explain why
remfor typography/spacing honors browser zoom & user accessibility font sizes whilepxignores font preferences. - Avoid the notorious
100vhmobile address-bar jump using100svh/100dvh.
Overview
Choosing CSS units well makes interfaces adapt naturally to giant monitors, tiny phones, and users who set their default browser font size to 20px or 24px for readability.
If .list { font-size: 1.2em; } holds nested lists, 1.2 * 1.2 * 1.2 = 1.728x snowballs out of control! rem (Root em) always measures straight against html (1rem = 16px at default), zero compounding, while still scaling up smoothly if a low-vision reader sets browser base text to 24px.
Sections covered in this lesson
- 1Picking the Right Unit Without Guesswork
Unlock "CSS Units: px, %, em, rem, ch, svh & dvh" and the full Modern HTML & CSS curriculum
Choose rem for scalable UI, ch for prose measure, percentages for fluidity, and svh/dvh to dodge mobile viewport bugs.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Modern HTML & CSS plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.