Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Units of Measurement | CSS Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. CSS Course

Lesson 9 of 50

·css

Units of Measurement

8 mins

Course progress18%

What you'll learn

Keep these ideas in mind as you work through the lesson.

3 points
  • `rem` is the preferred unit for spacing and font‑size because it stays consistent across the document.
  • `vw`/`vh` are perfect for fluid, full‑screen designs.
  • Avoid mixing `px` with `em`/`rem` for the same dimension; pick one system.

CSS units fall into three groups:

  1. Absolute – px, pt, cm, mm, in (rarely used for responsive layouts).
  2. Relative – em (relative to parent’s font‑size), rem (relative to root), % (relative to the parent element’s dimensions).
  3. Viewport – vw (1 % of viewport width), vh (1 % of viewport height), vmin, vmax.

Example: Full‑height hero section

.hero { height: 100vh; }
Make it stickPractice what you've learned1 quiz · 6 practical tests · Optional activities from CSS CourseBrowse activities
Previous lessonTypography BasicsContinue to lesson 10Display PropertyBack to CSS Course curriculum