Export (0) Print
Expand All

font

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

{ font: sFont }

sFont

String that specifies or receives 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. When used with the font property, this property must include a forward slash (/) before the value. 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.

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.

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>

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

Community Additions

ADD
Show:
© 2015 Microsoft