The Ultimate Guide to CSS Length Units

Should you always use pixels? What’s the difference between em and rem? Let’s walk through all the options you’ve got.

Mariana Vargas
Better Programming
Published in
7 min readMar 1, 2021

--

Illustration of a man trying to fill an HTML component in a web page
Image by vectorjuice in freepik

I’ve been working with CSS for years, and I must confess: I never completely understood CSS units until recently. There are so many options that it’s easy for a developer to stick only to the ones they…

--

--

UX Engineer | Singer-songwriter | Underground Influencer | Enthusiast of the Bizarre