CSS font
Property
Example
Specify all font properties in one declaration:
Property Definition and Usage
The font
shorthand property sets all font properties in one declaration.
The properties that can be set, in order, are: "font-style font-variant font-weight font-size/line-height font-family".
The font-size
and font-family
values are required. If other values are missing, default values will be inserted, if available.
Note: The line-height
property sets the space between lines.
Default value: | not specified |
---|---|
Inherited: | yes |
--- | --- |
Version: | CSS1 |
--- | --- |
JavaScript syntax: | object.style.font="italic small-caps bold 12px arial,sans-serif" |
--- | --- |
Browser Support
The numbers in the table specify the first browser version that supports the property.
Property | |||||
---|---|---|---|---|---|
font | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Font Properties
Value | Description |
---|---|
font-style | Specifies the font style. See: font-style |
font-variant | Specifies the font variant. See: font-variant |
font-weight | Specifies the font weight. See: font-weight |
font-size/line-height | Specifies the font size and line height. See: font-size line-height |
font-family | Specifies the font family. See: font-family |
caption | Defines the font used by caption controls (like buttons, dropdowns, etc.). |
icon | Defines the font used by icon labels. |
menu | Defines the font used by dropdown lists. |
message-box | Defines the font used by dialog boxes. |
small-caption | Smaller version of the caption font. |
status-bar | Defines the font used by window status bars. |
More Examples
Related Articles
CSS Tutorial: CSS Font