Name

font — NN n/a IE 4 CSS 1

Synopsis

Inherited: Yes

A shorthand attribute that lets you set one or more font-related attributes with one assignment statement. A space-delimited list of values (in any sequence) are applied to the specific font attribute for which the value is a valid type. 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 CSS2 font constants are as follows: caption | icon | menu | messagebox | smallcaption | statusbar. These constants refer to browser and operating system fonts used by the client. Their precise appearance are therefore different on different operating systems but are 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: 12pt serif}
H2 {font: bolder small-caps 16pt}
.iconCaption {font: caption}

Applies To

All elements.

Object Model Reference

IE

[window.]document.all.elementID.style.font

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.