Type: | font-style? font-weight? font-variant? font-size [/line-height]? font-family |
---|---|
Inherited: | yes |
Used By: | All text elements |
See: | font-family font-size font-style font-variant font-weight line-height |
The font attribute is a shortcut method of setting the font-family and zero or more of the font-style, font-weight, font-variant, font-size, line-height attributes in one go.
The font-family must be specified, but other attributes are optional. This attribute is best demonstrated by example, so here are some to start you off:
Set the font Helvetica
p { font:Helvetica }
Set the font to 14pt bold Helvetica
p { font:bold 14pt Helvetica }
Set the font to 14pt bold Helvetica with a line spacing of 18pt
p { font:bold 14pt/18pt Helvetica }
Set the font to bold italic small-caps Courier in the current font size
p { font:italic bold small-caps Courier }
Set the font to normal small-caps Courier, with the font size to "x-large" and the line height set to 100% - ie there's to be no leading
p { font:normal small-caps x-large/100% Courier }