Sitemap

Member-only story

How Big Is Big? A Simple Guide to Relative Units in CSS

7 min readMay 15, 2025

Alright, where were we? Oh right , the cascade, inheritance, and all the stuff around figuring out which style wins.

But now that we’ve got that sorted, let’s look at relative units which can make your styles more flexible.

Relative units

Pixels are probably the easiest unit to work with in CSS, it’s straightforward & predictable. But they’re absolute values.

A pixel is always a pixel. It doesn’t adapt, it doesn’t care about context.

A starfish in every life is still a starfish. There isn’t a life where a starfish is a professor of aerospace engineering.” Matt Haig, The Midnight Library

And just like that, 10 pixels on any page will always be 10 pixels, no matter the screen, zoom level, or user settings.

How Big Is Big? A Simple Guide to Relative Units in CSS

Other units like em and rem aren’t absolute, they’re relative. That means their values change depending on context. For…

--

--

Emad Dehnavi
Emad Dehnavi

Written by Emad Dehnavi

With 8 years as a software engineer, I write about AI and technology in a simple way. My goal is to make these topics easy and interesting for everyone.

No responses yet