Property Description
The font shorthand property sets all the font properties in one declaration.
The properties that can be set, are (in order): "font-style font-variant font-weight font-size/line-height font-family"
The font-size and font-family values are required. If one of the other values are missing, the default values will be used.
This property has the following syntax:
font: font-style font-variant font-weight font-size/line-height|caption|icon|menu|message-box|small-caption|status-bar|initial|inherit;
Property Values
Value | Description |
---|---|
font-style | Specifies the font style. See font-style for possible values |
font-variant | Specifies the font variant. See font-variant for possible values |
font-weight | Specifies the font weight. See font-weight for possible values |
font-size/line-height | Specifies the font size and the line-height. See line-height for possible values |
font-family | Specifies the font family. See font-family for possible values |
caption | Uses the font that are used by captioned controls |
icon | Uses the font that are used by icon labels |
menu | Uses the fonts that are used by dropdown menus |
message-box | Uses the fonts that are used by dialog boxes |
small-caption | A smaller version of the caption font |
status-bar | Uses the fonts that are used by the status bar |
initial | Specifies that the value of the property should be set to the default value |
inherit | Specifies that the value of the property should be inherited from the parent element |
Examples
This example sets all the font properties in one declaration.
p.ex1 {
font:20px arial,sans-serif;
}
p.ex2 {
font:
italic bold 12px/30px
Georgia, serif;
}
Browser Support
Chrome | Firefox | IE | Safari | Opera |
---|---|---|---|---|
1.0 | 1.0 | 4.0 | 1.0 | 3.5 |
Miscellaneous Information
Inherited: | Yes |
---|---|
Defined In: | CSS1 |
Default Value: | not specified |