Units of Length and Percentage
Unit Definition Example
em relative to the height of the font used in the element h1 {margin:0.5em}
ex relative to the height of the character 'x' for h2 {margin: 1ex}
the font used by the element
px size based on the number of screen pixels p {font-size:12px}
in in for inches (1 in = 2.54 cm) p {font-size: 0.5in}
cm cm for centimetres p {font-size: 0.3cm}
mm mm for millimetres p {font-size:3mm}
pt pt for points (1pt = 1/72 inches) p {font-size:12pt}
pc pc for picas (1pc= 12 points) p {font-size:1pc}
% a percentage value relative to the value of the parent element, p {line-height:120%}
depending on the properties used
Related examples in the same category