HTML and CSS Reference
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.
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
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
Height of the current font
Half an em in most browsers
Pixels (1/96 of an inch or 0.265 mm)
Inches (2.54 centimeters)
Centimeters (0.394 in)
Millimeters (0.039 in)
Points (1/72 of an inch or 0.353 mm)
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
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: