References : Style sheets
With cascading style sheets, fonts can be defined more precisely than with the tags and attributes of HTML 4.0. In the CSS1 specification, defined fonts were assumed to be on the client system and replacement fonts were proposed through properties. In CSS2, these possibilities have been expanded by granting authors greater flexibility to efficiently describe the fonts they want, and giving browsers more liberty to select or even download alternative fonts when the requested ones are not available.
font |
font-family |
font-size |
font-size-adjust
|
font-stretch |
font-style |
font-variant |
font-weight
| font |
|
|
| Shorthand property to set the six following properties in one go: font-style, font-variant, font-weight, font-size, line-height, and font-family. |
| |
| CSS1 value | [['font-style' || 'font-variant' || 'font-weight']? 'font-size' [/'line-height']? font-family |
| |
| CSS2 value | caption | icon | menu | message-box | small-caption | status-bar | inherit |
| |
| Initial value | See each individual property. |
| |
| Applied to | All elements. |
| |
| Inherited | Yes. |
| |
| Notes | Percentage values are allowed with font-size and line-height. For reasons of backwards compatibility, font-stretch and font-size-adjust have to be set through their individual properties. |
| |
Top |
|
| font-family |
|
|
| Defines a list of font family names and generic family names. |
| |
| CSS1 value | [[<family-name> | <generic-familly> [,]* [<family-name> | <generic-familly>] |
| |
| CSS2 value | inherit |
| |
| Initial value | Depends on the browser. |
| |
| Applied to | All elements. |
| |
| Inherited | Yes. |
| |
| Notes | <family-name> names the font family you choose (Arial, parameterFont Helvetica, or Bookman, for instance). <generic-family> names a generic font family among the following five values: serif, sans-serif, cursive, fantasy, or monospace. |
| |
Top |
|
| font-size |
|
|
| Defines the font size. |
| |
| CSS1 value | <absolute-size> | <relative-size> | <length> | <percentage> |
| |
| CSS2 value | inherit |
| |
| Initial value | medium |
| |
| Applied to | All elements. |
| |
| Inherited | The calculated value is inherited. |
| |
| Notes | A percentage relative to the parent element's font size is allowed. |
| |
Top |
|
| font-size-adjust |
|
|
| Authors have the possibility of specifying an aspect ratio or value that they want to preserve when alternative fonts are used. The aspect value is obtained by dividing the height of the font size by the font's x-height (the height of the lowercase letter x). |
| |
| CSS2 value | <number> | none | inherit |
| |
| Initial value | none |
| |
| Applied to | All elements. |
| |
| Inherited | Yes. |
| |
| Notes | A percentage relative to the parent element's font size is allowed. |
| |
Top |
|
| font-stretch |
|
|
| Selects a normal, condensed or expanded face from a font family. |
| |
| CSS2 value | normal | wider | narrower | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inherit |
| |
| Initial value | normal |
| |
| Applied to | All elements. |
| |
| Inherited | Yes. |
| |
Top |
|
| font-style |
|
|
| Selects the normal (a.k.a roman or upright), italic, or oblique face within a font family. |
| |
| CSS1 value | normal | italic | oblique |
| |
| CSS2 value | inherit |
| |
| Initial value | normal |
| |
| Applied to | All elements. |
| |
| Inherited | Yes. |
| |
Top |
|
| font-variant |
|
|
| Defines a normal or small-caps font. |
| |
| CSS1 value | normal | small-caps |
| |
| CSS2 value | inherit |
| |
| Initial value | normal |
| |
| Applied to | All elements. |
| |
| Inherited | Yes. |
| |
Top |
|
| font-weight |
|
|
| Specifies the weight of the font. |
| |
| CSS1 value | normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
| |
| CSS2 value | inherit |
| |
| Initial value | normal |
| |
| Applied to | All elements. |
| |
| Inherited | Yes. |
| |
| Notes | The values from 100 to 900 form an ordered sequence. Each number defines a weight that is at least as thick as the previous one. The weight of a normal font is 400, whereas the weight of bold characters is 700. |
| |
Top |
|