4. Measurements, URLs, and Color Units
In the discussion of CSS syntax in Chapter 1, you saw that the second part of each CSS declaration is a value. In this chapter, you’ll explore some common units for defining sizes (<length>
and <percentage>
), colors (<color>
), and URLs (<url>
) for defining these values.
Measurements
Dimensions and other measurements, such as font-size
, are not just raw numbers but a number of some specified of units of measure. CSS has quite a variety of measurement units; the most commonly used are outlined in the following sections.
Pixels (px
)
A pixel unit (<length>
) is a fixed measurement based on the size of a common ...
Get The CSS Pocket Guide now with the O’Reilly learning platform.
O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.