style.font (Property)

A special shortcut styling control that provides a way to define several font styling attributes in a single assignment.


CSS level - 1
DOM level - 2
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 6.0
Property/method value type:String primitive
JavaScript syntax:-myStyle.font
CSS syntax:font: aStyle aVariant aWeight aSize aLineHeight aFamily font: aConstant
Argument list:aStyleA font style value
aVariantA font variant
aWeightA font weight
aSizeA font size
aLineHeightA line height value
aFamilyA font family
aConstantA CSS font constant

This property can be assigned with a string containing space-separated keywords and values. The values are then unpacked and assigned to individual font styling properties.

The following font styling properties are collected together into this item:

Refer to the individual topics for these properties for details of the range of suitable values. For the style.font property, the values can be presented in any order since their namespaces do not collide.

As an alternative the CSS font constant values can be used to define font appearance according to a browser and platform specific macro. The following macros are supported:

These appearance of fonts styled according to these values are not defined in any standard but they will be consistent with text presented in the appropriate contexts on the client platform.

See also:style.fontFamily, style.fontSize, style.fontStyle, style.fontVariant, style.fontWeight, style.lineHeight