CSS2 » Properties » font

Version: Level 1/Expanded in Level 2

Compability: IE4+  N4+

font : font-style &| font-variant &| font-weight &| font-size &| | / line-height &| font-family |caption | icon | menu | message-box | small-caption | status-bar
status-bar (Level 2)
The status-bar value sets the font used in the window status bars.
small-caption (Level 2)
The small-caption value sets the font used for small controls.
message-box (Level 2)
The message-box value sets the font used in dialog boxes.
menu (Level 2)
The menu value sets the font used in drop-down menu boxes.
icon (Level 2)
The icon value sets the font used by icon labels.
caption (Level 2)
The caption value sets the font used by caption controls, such as buttons.
font-style font-variant font-weight font-size / line-height font-family

For values, see the individual home pages.

The font property allows you to combine together in only one declaration any, or all of six individual CSS properties related to font. Each of these six individual properties is discussed on its own page. This property is inherited.

In addition, effective with Level 2, the font property can also be used to declare six values that set system font settings.


p { font:  italic  small-caps  600  12pts/18pts  Courier; }
p { font:  italic  small-caps  600  12pts/150%  Courier; }
p { font:  italic  small-caps  600  12pts/1.5  Courier; }
p { font:  italic  small-caps  600  12pts/18pts  Courier; }
p { font:  /18pts  serif; }
p { font:  oblique  100  24pts; }

Note the forward slash before / line-height. It must appear and is used in association with the font size. The use of the / is demonstrated in these code examples.

Language(s): CSS2

See Also: