Units for Property Values
In the table of properties and values and in the examples on various pages, you will have noticed that values for many attributes are given in one of several different units, usually:
- pt (points)
- in (inches)
- cm (centimeters)
- px (pixels)
- % (of some other value, usually the font size)
In most cases which unit you use doesn't make much difference, so long as you're familiar with it (authors in the US may prefer to use inches, whereas those in most other countries may prefer centimeters, for instance; most of us are used to specifying font sizes in points, though few seem to actually know what a point is -- 1/72 inch). One issues should be noted, though. Unlike the first three units, pixels do not designate an absolute distance; instead a pixel is a unit of display height or width, which depends on the resolution setting for the display. Resolution settings vary considerably, with most users still using 640x480 pixels, while with the increasing prevalence of 17" or larger monitors and better graphics accelerators, resolutions of 1024x768 or even higher are not uncommon. For this reason, pixel values are not generally recommended to define sizes. Pixels may be most appropriate in some cases, though, such as overlaying text on an image, because images are generally sized in pixels. Above all else, it's important to test your pages at different resolutions.