Quiz Entry - updated: 2026.07.14
What are the common CSS measurement units?
CSS sizes elements with either relative units (px, em, %), which depend on something else, or absolute units (mm, in, pt), which are fixed physical measures and rarely used on screen.
Measurement units set the dimensions of things like fonts, images, margins, and spacing. Today relative units dominate because they adapt to context:
| Unit | Relative to |
|---|---|
px |
The pixel density of the output device |
em |
The font size of the element |
% |
Usually the parent element |
The absolute units describe real-world physical lengths and are mostly useful for print, not screens:
| Unit | Meaning |
|---|---|
mm |
Millimeters |
in |
Inches (1 in = 2.54 cm) |
pt |
Points (1 pt = 1/72 inch) |
In code these read naturally:
font-size: 1.2em; /* 120% of the element's font size */
width: 50%; /* half the parent's width */
padding: 16px; /* a pixel-based spacing */
Best practice: prefer relative units so a layout scales sensibly across phones, tablets, and large monitors — a value fixed in millimeters can't adapt to a screen it knows nothing about.