Length Values

A length value is expressed as a positive or negative number (when permitted), followed immediately by a two-letter abbreviation that represents the units to be used. There should never be any space between the number and the unit designator. Note that a value of 0 (zero) need not have a unit designator. Length units are divided into two types: absolute units, which are (in theory) always measured in the same way, and relative units, which are measured in relation to other things.

Absolute length units

Inches (in)

As you might expect, the same inches found on typical U.S. rulers. The mapping from inches to a monitor or other display device is usually approximate at best because many systems have no concept of the relation of their display areas to “real-world” measurements such as inches. Thus, inches should be used with extreme caution in screen design.

Centimeters (cm)

The centimeters found on rulers the world over. There are 2.54 cm to an inch, and 1 centimeter equals 0.394 inches. The same mapping warnings that applied to inches also apply to centimeters.

Millimeters (mm)

There are 10 millimeters to a centimeter, so you get 25.4 mm to an inch, and 1 millimeter equals 0.0394 inches. Bear in mind the previous warnings about mapping lengths to monitors.

Points (pt)

Points are standard typographical measures used by printers and typesetters for decades and by word-processing programs for many years. By modern definition, there are 72 points to an inch. Therefore, the capital ...

Get CSS Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.