HTML and CSS Reference
In-Depth Information
Chapter 9
There are several units to choose from when specifying the size of a property's value.
Absolute units
The absolute units of length are centimeter ( cm ), millimeter ( mm ), and inch ( in ). Although
these units are meant to look the same regardless of the screen resolution, it is not always
the case because web browsers do not always know the exact physical size of the display
.one-cm { font-size: 1cm; }
.one-mm { font-size: 1mm; }
.one-in { font-size: 1in; }
These units are mainly useful when the size of the output medium is known, such as
for content that will be printed to paper. They are not recommended for screen displays
because the screen sizes can vary a lot.
Typographical units
Points ( pt ) and picas ( pc ) are typographical units. By definition, there are 72 points to an
inch and 12 points to one pica. Like the absolute units, the typographical units are most
useful for print style sheets, not for onscreen use.
.one-point { font-size: 1pt; }
.one-pica { font-size: 1pc; }
Relative units
The relative units of length are pixel ( px ) and percentage ( % ). A percentage is a unit
proportional to the parent's value for that property; a pixel is relative to the physical pixel
on the display device used.
.one-pixel { font-size: 1px; }
.one-percent { font-size: 1%; }
Search WWH ::

Custom Search