What Is the Em Unit in CSS?

Dan Gold

Written by Dan

The em unit in CSS is a relative measure of font size. It’s defined as the current font size multiplied by the value of the font-size property. So, if you set the font-size to be 1em, then all other properties that are specified using ems will be relative to that base size.

This can be useful for creating responsive layouts, since you can change the font-size on a parent element to scale all child elements proportionally.

Last updated

November 8th, 2022