Search⌘ K
AI Features

Font-Relative Units

Explore the core font-relative units in CSS including em, rem, ex, and ch. Understand how these units affect element sizing based on font size and characteristics, helping you build flexible and consistent web designs. This lesson clarifies when to use each unit for responsive layouts and typography.

The em unit

.element {
  width: 30em; 
}

The em unit is the value assigned to the element’s font-size, and its exact value changes between elements. The measurement itself is the width of the letter “m.”

The length changes only if we change the font-size. It doesn’t change if the font-family is ...