There are two types of length units: relative and absolute. Relative length units specify a length relative to another length property. Style sheets that use relative units will more easily scale from one medium to another (e.g., from a computer display to a laser printer). - W3C Relative units are:
- em: the 'font-size' of the relevant font
- ex: the 'x-height' of the relevant font
- px: pixels, relative to the viewing device
The .em unit can be troublesome, though theoretically it is ideal. Read the following from the W3C specs and note the potential pitfalls:
The 'em' unit is equal to the computed value of the 'font-size' property of the element on which it is used. The exception is when 'em' occurs in the value of the 'font-size' property itself, in which case it refers to the font size of the parent element. It may be used for vertical or horizontal measurement. (This unit is also sometimes called the quad-width in typographic texts.)