Length Units

2008 Oct 17


Absolute Units
Name Abrev Note
Centimeters cm  
Inches in  
Millimeters mm  
Pica pc  
Pixels px 72/inch .. 96/inch .. 120/inch
Points pt 72/inch

Most length units can be a positive or negative number followed by a label, although some properties do not accept negative numbers. Decimal fraction numbers are allowed, e.g. 3.14.

CSS2 recommends 90px/in, while CSS2.1 recommends 96px/in. CSS1 made the mistake of using screen pixels as printer pixels, which could be 600/in.

Relative Units
Abrev Note
em Value of font-size, e.g. if font-size is 12 pixels then 1em is 12 pixels.
ex Height of a lower case x in current font.
Some have 1ex=0.5em
px May not allow user to resize text!