HTML and CSS Reference

In-Depth Information

Length Values

A length value is expressed as a positive or negative number (when permitted), followed im-

mediately 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. A value of
0
(zero) does not require

a unit designator. Length units are divided into two types: absoluteunits, which are (in theory)

always measured in the same way, and relativeunits, which are measured in relation to other

things.

Absolute Length Units

Inches

Inches(
iin
)

As you might expect, the same inches found on typical US 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” measure-

ments such as inches. Thus, inches should be used with extreme caution in screen design.

Centimeters

Centimeters(
ccm
)

The centimeters found on rulers the world over. There are 2.54 centimeters to an inch, and

1 centimeter equals 0.394 inches. The same mapping warnings that applied to inches also

apply to centimeters.

Millimeters

Millimeters(
mmm
)

There are 10 millimeters to a centimeter, so you get 25.4 millimeters to an inch, and 1 mil-

limeter equals 0.0394 inches. Bear in mind the previous warnings about mapping lengths

to monitors.

Points

Points(
ppt
)

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 letters of text set to 12 points should be one-sixth

of an inch tall. For example,
p {font-size: 18pt;}
is equivalent to
p {font-size:

0.25in;}
, assuming proper mapping of lengths to the display environment (see previous

comments).