CSS font property
Specifies all font properties in one declaration:
{
font:15px arial,sans-serif;
}
p.ex2
{
font:italic bold 12px/30px Georgia, serif;
}
Try it out . . .
There are more examples at the bottom of this page.
Description of property definition and use
Font short-write properties set all 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 values font-size and font-family are required. If additional values are missing, the default values are inserted, if any.
Note: The line-height property sets the space between rows.
Default: | 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 support the first browser version number of the property.
Attributes | |||||
---|---|---|---|---|---|
font | 1.0 | 4.0 | 1.0 | 1.0 | 3.5 |
Font features
Value | Describe |
---|---|
font-style | Specify the font style. See also: Possible values in font-style. |
font-variant | Specifies that the font is foreign. See also: Possible values in font-variant. |
font-weight | Specify the font weight. See: Possible values in font-weight. |
font-size/line-height | Specify font size and line height. See: Possible values in font-size and line-height. |
font-family | Specify the font family. See also: Possible values in font-family. |
caption | Define the font used by title controls, such as buttons, pull-down lists, and so on. |
icon | Define the font used by the icon marker. |
menu | Define the font used by the down-down list. |
message-box | Define the font used by the dialog box. |
small-caption | A small version of the caption font. |
status-bar | Define the font used by the window status bar. |
More instances
Some other font property values
This example demonstrates some other font property values.
Related articles
CSS tutorial: CSS Font