Skip to main content
Module 5 · Lesson 3 of 419/60 in the course~18 min
Module lessons (3/4)

CSS Units: px, %, em, rem, ch, svh & dvh

Lesson preview5 hands-on exercises readyModern HTML & CSS · The Box Model, Display & Modern Units

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 units vw/svh/dvh.
  • Explain why rem for typography/spacing honors browser zoom & user accessibility font sizes while px ignores font preferences.
  • Avoid the notorious 100vh mobile address-bar jump using 100svh / 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

  1. 1Picking the Right Unit Without Guesswork
Pro Lesson · The Box Model, Display & Modern Units

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.