The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

font property

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


font: [ [ font-style || font-variant || font-weight ]? font-size [ / line-height ]? font-family ] | caption | icon | menu | message-box | small-caption | status-bar

Property values

A variable of type String that specifies or receives up to six of the following space-delimited property values. Alternatively, sets or retrieves the six listed text fonts.


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


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


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


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


Any of the range of line-height values available to the line-height property. When used with the font property, this attribute must include a 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.


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.


User-preference font used in objects that have captions—buttons, labels, and so on.


User-preference font used in icon labels.


User-preference font used in menus.


User-preference font used in dialog boxes.


User-preference font used in small controls.


User-preference font used in window status bars.

CSS information

Applies ToAll elements
Initial Valuethe concatenation of the initial values of its longhand properties


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 font-family 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.

When you use the !DOCTYPE declaration to specify standards-compliant mode, the following conditions apply to this property.

  1. The font-size and font-family values must be declared. If font-size and font-family are not declared, or are not in the correct order, the font property is ignored.
  2. All specified values must appear in the correct order. Otherwise, the font property is ignored.
  3. In standards-compliant mode, the default font-size is small, not medium. If not explicitly set, font-size returns a point value.


This example displays three lines of text using different font settings.

body {
  font: Garamond, serif;
.sans-serif {
  font: italic small-caps 12pt Arial, sans-serif;
.monospace {
  font: bold 14pt Courier, monospace;

  <p>Lorem ipsum dolor sit amet... (font: Garamond, serif)</p>
  <p class="sans-serif">Lorem ipsum dolor sit amet... (font: italic small-caps 12pt Arial, sans-serif)</p>
  <p class="monospace">Lorem ipsum dolor sit amet... (font: bold 14pt Courier, monospace)</p>

The following image shows the result. The first line of text shows the default body element font setting that specifies a font from a serif font family. The second line of text shows a font setting that specifies an italic font style, small-caps font variant, 12-point font size, and a font from a sans-serif font family. The third line of text shows a font setting that specifies a bold font weight, 14-point font size, and a font from a monospace font family:

An image showing text with different font property settings.

See also

CSS Values and Units Reference



© 2014 Microsoft