What is CSS em unit?

The em unit is relative to the font-size of the element's parent. 1em equals the parent element's font size.

Parent: 16pxChild: 1em = 16px

Frequently Asked Questions about em units

How is em different from rem?
em is relative to the parent element's font size, while rem is relative to the root element's font size.
When should I use em?
Use em for sizes that should scale with the parent element's font size, like padding or margins in text-based components.