Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

font

Resumo

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


Sintaxe

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

Valores

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:

caption 
The font used for captioned controls (e.g., buttons, drop-downs, etc.).
icon 
The font used to label icons.
menu 
The font used in menus (e.g., dropdown menus and menu lists).
message-box 
The font used in dialog boxes.
small-caption 
The font used for labeling small controls.
status-bar 
The font used in window status bars.
-moz-window 
-moz-document 
-moz-workspace 
-moz-desktop 
-moz-info 
-moz-dialog 
-moz-button 
-moz-pull-down-menu 
-moz-list 
-moz-field 

Exemplos

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 }

Notas

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.

Especificações

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

Categorias

Interwiki Language Links

Etiquetas do documento e colaboradores

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