CSS/Properties/font
From W3C Wiki
< CSS | Properties
Contents |
font
The font property is a shorthand property for setting the individual font properties (i.e., 'font-style', 'font-variant', 'font-weight', 'font-size', 'line-height' and 'font-family') at the same place in the style sheet.
Description
| Values | [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]? <'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit |
|---|---|
| Initial value | See individual properties |
| Applies to | All elements |
| Inherited | Yes |
Values
caption
he font used for captioned controls(e.g., buttons, drop-downs, etc.).
icon
The font used to label icons.
menu
The font used in menus (e.g., dropdown menus and menu lists).
message-box
The font used in dialog boxes.
small-caption
The font used for labeling small controls.
status-bar
The font used in window status bars.
inherit
Takes the same specified value as the property for the element's parent.
And see also individual properties
Example
Example A
[style.css]
h1{
font: bold 1.2em Helvetica, Arial, sans-serif;
}
p{
font: italic 30px Times, Garamond;
}
[index.html]
<body> <h1>font property example</h1> <p>This is a paragraph.</p> </body>
CSS Reference
The CSS specification defines the font property in 15.8 Shorthand font property.

