This CSS units reference explains absolute and relative length units in CSS — px, em, rem, %, vw, vh and more — so you know when to use each for responsive design.
| Unit | Type — meaning |
|---|---|
| px | Absolute — one device pixel |
| pt | Absolute — 1/72 inch (print) |
| in / cm / mm | Absolute — physical length |
| em | Relative — to the element font-size |
| rem | Relative — to the root font-size |
| % | Relative — to the parent value |
| vw | 1% of viewport width |
| vh | 1% of viewport height |
| vmin | 1% of the smaller viewport side |
| vmax | 1% of the larger viewport side |
| ch | Width of the "0" character |
| ex | Height of the lowercase x |
| fr | Fraction of free space (grid) |