1.0 Units of Measurement
HTML attributes and CSS property values (such as height, width and font-size for example) can be specified in one of two ways:
Absolute values have a specific value that are fixed, allowing precise measurements, such as millimetres, inches, etc. Relative values have no fixed, specific value and are calculated in comparison to a current value. Because Web pages can be viewed across different browsers and platforms, it is wiser to use relative values.
| Absolute Measurement | ||
|---|---|---|
| Abbreviation | Unit | Description |
| in | Inches | 1in = 6pc |
| pt | Points | 1in = 72pt |
| picas | pc | 1pc = 12pt |
| mm | millimetres | 1in = 25.4mm |
| cm | centimetres | 1cm = 10mm |
| Relative Measurement | ||
| Abbreviation | Unit | Description |
| px | pixels | There are typically between 72 and 90 pixels/inch |
| em | em space | An em space is the width and height of the capital letter M base upon the current font and size |
| ex | x space | 1ex based on height of lowercase x (usually about half the font-size) |
| % | Percentage | Defines a measurement as a percentage relative to another value |