css units

Css offers a number of different units for expressing length.

  • relative length units
  • absolute length units
relative length unitsdescription
%percentage
pxpixels, relative to the viewing device.
emthe computed font-size.1em is equal to the current font-size.
exthe height of a lowercase "x".
vwthe viewport width
vhthe viewport height
vmthe smaller value of viewport width or height.
chzero-width (width of the zero glyph in the rendering font).
absolute length unitsdescription
ininches (1 inch = 2.54 centimeters).
cmcentimeters.
mmmillimeters.
ptpoints (1  point = 1/72 inches).
pcpicas (1 ) (1 pica = 12points).