Cascading Style Sheets/Lengths
From WikiKnowledge
| in | Inches. |
| cm | Centimeters. |
| mm | Millimeters. |
| pt | Points (1/72 of an inch). |
| pc | Picas (12 Points). |
| em | relevant to nearest font size. |
| ex | x-height, the height of the letter x. |
| px | Pixels |
| % | Percentages |
Lengths given in one of the absolute measurements (in, cm, mm, pt and pc) are very unreliable when used on a computer monitor, because most computers don't know how big you monitor is. They are generally only used for print style sheets.
Contents |
[edit] em
The em measurement is the width of the lowercase letter m in a font. This is relevant to the nearest font size. For example, it the font size is 24 pixels, then 1em is 24 pixels, 0.5em's is 12 pixels and 2em's are 48 pixels.
| CSS | Result |
|---|---|
| font-size: 0.5em; | This text is 0.5 em's |
| font-size: 1em; | This text is 1 em |
| font-size: 2em; | This text is 2 em's |
[edit] ex
The ex measurement or x-height is the height of the lowercase letter x in a font. Note that some browsers take a shortcut and will assume that the x-height is the same as 0.5em. [1]
[edit] px
This gives the length in pixels. Pixels are the tiny dots of color that makeup a computer display, therefore px is best used for defining the size of object displayed on a computer screen. It is best to avoid using them for style sheets used for printing a page on paper.
[edit] References
- ↑ Beginning CSS Cascading Style Sheets for Web Design p67 ISBN0764576429
