The font property is a shorthand property for setting font-style, font-variant, font-weight, font-size, line-height and font-family at the same place in the style sheet.

  • Valor inicial: refere-se a propriedades individuais
  • Aplica-se a: todos os elementos
  • Herdado: sim
  • Mídia: Visual


font: [ <font-style> || <font-variant> || <font-weight> ]? <font-size> [ / <line-height> ]? <font-family>

font: caption | icon | menu | message-box | small-caption | status-bar | -moz-window | -moz-document | -moz-workspace | -moz-desktop | -moz-info | -moz-dialog | -moz-button | -moz-pull-down-menu | -moz-list | -moz-field

font: inherit


Using the font shorthand property sets the longhand properties as specified, and sets all other font-related properties to their initial values.

See font-style, font-variant, font-weight, font-size, and font-family for legal values of each property.

System fonts can also be specified using the font property, instead of specifying individual longhand properties:

The font used for captioned controls (e.g., buttons, drop-downs, etc.).
The font used to label icons.
The font used in menus (e.g., dropdown menus and menu lists).
The font used in dialog boxes.
The font used for labeling small controls.
The font used in window status bars.


View Live Examples

/* Set the font size to 12pt and the line height to 14pt. Set the font family to sans-serif */
p { font: 12pt/14pt sans-serif }
/* Set the font size to 80% of the parent tag or default value (if no parent tag present) 
and set the font family to sans-serif */ 
p { font: 80% sans-serif }
/* Set the font weight to bold, the font-style to italic, the font size to large, 
and the font family to serif. */
p { font: bold italic large serif }


The font-size and font-family parts of the shorthand are mandatory. Omitting them is a syntax error, and causes the entire declaration to be ignored.

Properties for which no values are given are set to their initial value, which is normal for all properties that can be omitted (font-style, font-variant, font-weight, and line-height).

The font-size-adjust property is also set to its initial value (none) when the font shorthand property is specified.


Compatibilidade com navegadores

Navegador Versão mais antiga
Internet Explorer 3
Netscape 4
Opera 3.5

Veja também

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


Interwiki Language Links

Etiquetas do documento e contribuidores

 Contribuidores para esta página: teoli, Verruckt
 Última atualização por: teoli,