First page Back Continue Last page Graphics
Unit Measurements
In CSS, you can measure units either in absolute values or in relative values.
Absolute values are fixed, specific values. Since they are exact measurements, they allow the designer complete control over the display of the web pages.
- mm, cm, in, pt, pc, xx-small, x-small, small, medium, large, x-large, xx-large
Relative values have no fixed, specific values, and are calculated in comparison to something else (usually the size of the default font or line size). Because different computers have different video cards, screen sizes, and users have differing eyesight abilities, relative values tend to be a better choice. They give the designer less absolute control but it often creates a better experience for the visitor.
- em, ex, px, larger, smaller, num%
Examples:
body { font-size: 12px; }
h1, h2, h3 { line-height: 200%;}
Note – a warning about using percentages: if you use percentages, and nest an element inside of that same element, the percentages will be cumulative.