The font property in CSS is a shorthand property that combines all the following sub-properties in a single declaration.
body {
font: normal small-caps normal 16px/1.4 Georgia;
}
/* is the same as:
body {
font-family: Georgia;
line-height: 1.4;
font-weight: normal;
font-stretch: normal;
font-variant: small-caps;
font-size: 16px;
}
*/
There are seven font sub-properties, including:
font-stretch sets the font width
- normal
- ultra-condensed
- extra-condensed
- condensed
- semi-condensed
- semi-expanded
- expanded
- extra-expanded
- ultra-expanded
|
font-style italicised or oblique.
- normal
- italic
- oblique
- inherit
|
font-variant display as small caps.
- normal
- small-caps
- inherit
|
font-weight sets the weight
- normal
- bold
- bolder
- lighter
- 100, 200, 300, 400, 500, 600, 700, 800, 900
- inherit
|
font-size sets the height
- xx-small
- x-small
- small
- medium
- large
- x-large
- xx-large
- smaller, larger
- percentage
- inherit
|
line-height defines the amount of space above and below inline elements.
- normal
- number (font-size multiplier)
- percentage
|
font-family Font face
- sans-serif
- serif
- monospace
- cursive
- fantasy
- caption
- icon
- menu
- message-box
- small-caption
- status-bar
- "string"
|