fontNN 6 IE 4 CSS 1

Inherited: Yes

This is a shorthand attribute that lets you set multiple font-related attributes with one assignment statement. Some browsers are more forgiving than others about required and optional values, but this attribute should at least specify the font-size and font face (either by font-family or CSS2FontConstant values) in that order. The order of other space-delimied value types is not critical. In CSS2, some additional short-circuit constants apply named system fonts that have fixed values for each of the font-related attributes.

 
CSS Syntax
 
font: font-style || font-variant || font-weight || font-size[/line-height] ||
font-family | CSS2FontConstant
 
Value

For syntax and examples of value types for font and line attributes, see the respective attribute listing. The construction with the forward slash before the line-height value allows the use of a second length value within the potentially long sequence of values for this attribute: the line-height length value must always accompany the required font-size value, separated by a forward slash.

The CSS2 font constants are as follows: caption | icon | menu | message-box | small-caption | status-bar. These constants refer to browser and operating system fonts used by the client. Their precise appearance is therefore different on different operating systems but consistent with the user's expectation for a particular type of font. In other words, these styles should be used when their function mirrors a system or browser function.

 
Initial Value

None.

 
Example
 
body {font: 12px serif}
h2 {font: bolder small-caps 16px "Lucida Console", Arial, sans-serif}
.iconCaption {font: 10px/1.1em caption}
 
Applies To

All elements.

 
Object Model Reference
 
[window.]document.getElementById("elementID").style.font