HTML and CSS Reference
In-Depth Information
refers to both cases as number . CSS3 explicitly states when only an integer is accepted. In some cases, the range is
limited or only positive numbers can be used.
Numbers must not contain spaces or the thousands separator. Decimal fractions use a decimal point (dot).
You can't use a comma as the decimal point, as is common in some European countries.
Length
The CSS specifications use the term length to refer to vertical and horizontal measurements. The CSS3 Values
and Units module introduces several new units of measurement, as well as a function that allows the browser to
calculate a length value. These new features are not supported by all browsers, so I'll describe them separately to
avoid confusion.
Length Units Supported by All Browsers
Table 3-1 lists the length units in CSS2.1 that are supported by all browsers.
Table 3-1. CSS2.1 Length Units
Type
Unit
Description
Relative Units
em
Height of the current font
ex
Half an em in most browsers
Absolute Units
px
Pixels (1/96 of an inch or 0.265 mm)
in
Inches (2.54 centimeters)
cm
Centimeters (0.394 in)
mm
Millimeters (0.039 in)
pt
Points (1/72 of an inch or 0.353 mm)
pc
Picas (12 points or 4.233 mm)
Length units are classified as either relative or absolute. A relative unit is not a fixed size, but is relative to
another length. The relative units in CSS2.1 take their value from the current font size. But CSS3 introduces units
that are relative to the browser viewport. An absolute unit is anchored to a physical measurement, such as an inch
or centimeter.
There must be no space between the number (which can include a decimal fraction) and the unit. The unit
of measurement is optional after 0. For example, the following values are correct:
0.5em
300px
0px
0
 
Search WWH ::




Custom Search