|
Lots of the CSS properties accept sizes. Here’s a bit more information. Length unitsLengths refer to horizontal or vertical measurements. To specify a length, enter a plus or minus sign, followed by a number, followed by a two-letter abbreviation that indicates the unit. There are no spaces in a length value: 1.3 em is not a valid length value, but 1.3em is. A length of 0 does not require the two-letter unit identifier. There are two type of lengths: relative and absolute. Relative units give a length relative to another length property and W3C prefers them because they adjust better to different media (screens and printers for example). The following relative units are available:
Absolute length units are very much dependent on the output medium (a Mac is 72dpi and Windows is 96dpi), and so are less useful than relative units. The following absolute units are available:
You might decide to use inches, centimetres or millimetres because they are familiar but there are a couple of problems to be aware of.
Percentage unitsTo specify a percentage, enter a plus or minus sign, followed by a number, followed by %. There are no spaces in a percentage value. For example, -25%, +15% or 75% Percentage values are relative to other values, as defined for each property. Most often the percentage value is relative to the tag's parent. KeywordsSome properties can have keywords. The browser translates the keyword to numerical values. Some example keywords are bold, bolder, smaller, or x-large. URL valuesA url can be absolute or relative. To enter an absolute url, you specify the full path. For example: http://www.ann.com/pages/index.htm. To specify a relative url, enter ../pages/index.htm. |
More information CSS units |