5.11. Standard Property Units

Cascading style sheets allow you to specify sizes and colors in a variety of different formats. You can specify lengths in either absolute or relative units, using either integers or decimal floating-point numbers. Some properties allow negative lengths, which are indicated by a leading minus sign (“–”) before a length otherwise specified in the normal manner.

Lengths

Cascading style sheets permit authors to use any of the following formats in Table 5.1 for properties that describe le5.1 ngths (sizes).

Table 5.1. Absolute and Relative Length Units
cm Centimeters (absolute unit)
em The height of the current font (relative unit)
ex The height of the letter “x” in the current font (relative unit)
in Inches (absolute ...

Get Core Web Programming, Second 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.