font

Sets a combination of separate font properties of the object. Alternatively, sets one or more of six user-preference fonts.

Syntax

{ font: sFont }

Possible values

sFont

String that specifies up to six of the following space-delimited property values, or, alternatively, sets the six listed text fonts:

font-style

Any of the range of font-style values available to the font-style property.

font-variant

Any of the range of font-variant values available to the font-variant property.

font-weight

Any of the range of font-weight values available to the font-weight property.

font-size

Any of the range of font-size values available to the font-size property. When this value is an integer followed by a percent sign (%), the value is a percentage of the font size of the parent object.

line-height

Any of the range of line-height values available to the line-height property. Line height percentage values are calculated as a percentage of the font size of the element itself, not of the parent.

font-family

Any of the range of font-family values available to the font-family property. This property can be set to multiple comma-separated values. Its default value depends on user settings.

This property has a default value of normal normal normal medium normal "Times New Roman". It is inherited.

Remarks

This is a composite property that specifies up to six font values. The font-style, font-variant, and font-weight values may appear in any order before font-size. However, the font-size, line-height, and font-family properties must appear in the order listed. Setting the font property also sets the component properties. In this case, the string must be a combination of valid values for the component properties; only the font-family value may have more than one value. If the string does not contain a value for a component property, that property is set to its default, regardless of prior settings for that component property.

Examples

The following example uses the font property to change font characteristics. This example uses an inline style sheet to set the font attributes:

<span style="font:italic normal bolder 12pt Arial"> 
  Note 
</span>

Standards information

This property is defined in Cascading Style Sheets (CSS), Level 1 (CSS1) Ee371240.xtlink_newWindow(en-us,Expression.40).png.

Applies to

a, address, b, big, blockquote, body, button, caption, center, cite, code, col, colgroup, custom, dd, defaults, dfn, div, dl, dt, em, fieldset, form, hn, html, i, img, input type=button, input type=checkbox, input type=file, input type=image, input type=password, input type=radio, input type=reset, input type=submit, input type=text, li, ol, p, s, select, span, sub, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var, xmp

See also

Concepts

font-style
font-variant
font-weight
font-size
line-height
font-family

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.