CSS Property: font
Font characteristics. Some, or all, of font name, font size, boldness, italics, small-caps, and line-height.
A shorthand property that combines:
Possible Values
A list of values taken from font-family
, font-size
, font-weight
, font-style
, font-variant
, and line-height
(see individual property pages for details of the possible values for each characteristic):
[style] [variant] [weight] [size]/
[line-height] [family]
Example: italic small-caps bold 12px/1.5 Helvetica, Arial, sans-serif
The font-size
and font-family
value portions are required but the others are optional. Any excluded values will default to their initial value.
inherit
, initial
, or unset
can also be used on their lonesome.
Example
.shorthand1 { font: italic small-caps bold 12px/1.5 Helvetica, Arial, sans-serif; }
/* ...is the equivalent of... */
.longhand1 {
font-style: italic;
font-variant: small-caps;
font-weight: bold;
font-size: 12px;
line-height: 1.5;
font-family: Helvetica, Arial, sans-serif;
}
.shorthand2 { font: bold 1.5em Times, "Times New Roman", serif; }
/* ...is the equivalent of... */
.longhand2 {
font-style: initial;
font-variant: initial;
font-weight: bold;
font-size: 1.5em;
line-height: initial;
font-family: Times, "Times New Roman", serif;
}