You are here: Reference > appendix > css > length
The syntax for lengths is a number immediately followed by a unit identifier.
You can use lengths for the value of several style properties (width, height, left, top, right, bottom, font-size, etc.). Some properties allow negative length values, but if a negative length value is set on a property that does not support it, the declaration is dropped.
There are two types of length units:
|1.||-||Relative length units specify lengths relative to other measures. Pages using relative length units can be scaled more easily from one device to another.|
|2.||-||Absolute length units define absolute measurements which are useful if the physical properties of the output device are known.|
|Relative length units|
|em||The font-size of the relevant element.|
|ex||The x-height of the relevant element's font. This is commonly the height of the lowercase 'x'.|
|px||Pixels, relative to the viewing device. The px unit identifies a simple pixel, although for printers and very high resolution screens it may identify multiple pixels.|
|Absolute length units|
|in||inches (1 inch is equal to 2.54cm)|
|pt||points (1 point is equal to 1/72 inches)|
|pc||picas (1 pica is equal to 12 point)|
User Contributed Comments