outline

Sumário

A propriedade CSS outline é uma propriedade abreviada para configurar uma ou mais das propriedades de contorno outline-style (en-US), outline-width (en-US) e outline-color (en-US) em uma única declaração. Na maioria dos casos o uso abreviado é preferível e mais conveniente.

Contornos se diferenciam de bordas das seguintes maneiras:

  • Contornos não ocupam espaços, eles são desenhados acima do conteúdo.
  • Contornos podem não ser retangulares. Eles são retangulares no Gecko/Firefox. Mas por exemplo, Opera desenha uma forma não retangular em torno de uma construção como este: TEXTTEXTTEXT
Initial valueas each of the properties of the shorthand:
Aplica-se aall elements
Inheritednão
Computed valueas each of the properties of the shorthand:
  • outline-color (en-US): For the keyword auto, the computed value is currentcolor. For the color value, if the value is translucent, the computed value will be the rgba() corresponding one. If it isn't, it will be the rgb() corresponding one. The transparent keyword maps to rgba(0,0,0,0).
  • outline-width (en-US): an absolute length; if the keyword none is specified, the computed value is 0
  • outline-style (en-US): as specified
Animation typeas each of the properties of the shorthand:

Sintaxe

css
/* largura | estilo | cor */
outline: 1px solid white;

/* Valores globais */
outline: inherit;
outline: initial;
outline: unset;

Valores

Um, dois ou três valores, dada em ordem arbitrária:

<'outline-width'>

Veja outline-width (en-US).

<'outline-style'>

Veja outline-style (en-US).

<'outline-color'>

Desde Gecko 1.9 (Firefox 3), o valor da propriedade color (cor de primeiro plano) é usado. Veja outline-color (en-US).

Sintaxe completa

outline = 
<'outline-color'> || (en-US)
<'outline-style'> || (en-US)
<'outline-width'>

Exemplos

css
/* duas declarações identicas */

:link:hover {
  outline: 1px solid #000;
}
:link:hover {
  outline: solid black 1px;
}

Especificações

Specification
CSS Basic User Interface Module Level 4
# outline

Compatibilidade com navegadores

BCD tables only load in the browser