Propriedade de sombra da caixa de estilo
Exemplo
Adicione um box-shadow a um elemento div:
document.getElementById("myDIV").style.boxShadow = "10px 20px 30px blue";
Definição e uso
A propriedade boxShadow define ou retorna as sombras projetadas de um elemento de caixa.
Suporte ao navegador
Property | |||||
---|---|---|---|---|---|
boxShadow | Yes | 9.0 | Yes | 5.1.1 | Yes |
Sintaxe
Retorne a propriedade boxShadow:
object.style.boxShadow
Defina a propriedade boxShadow:
object.style.boxShadow = "none|h-shadow v-shadow blur spread color |inset|initial|inherit"
Nota: A propriedade boxShadow anexa uma ou mais sombras projetadas à caixa. A propriedade é uma lista de sombras separadas por vírgulas, cada uma especificada por 2-4 valores de comprimento, uma cor opcional e uma palavra-chave de inserção opcional. Os comprimentos omitidos são 0.
Valores de propriedade
Value | Description |
---|---|
none | Default value. No shadow is displayed |
h-shadow | Required. The position of the horizontal shadow. Negative values are allowed |
v-shadow | Required. The position of the vertical shadow. Negative values are allowed |
blur | Optional. The blur distance |
spread | Optional. The size of shadow |
color | Optional. The color of the shadow. The default value is black. Look at CSS Color Values for a complete list of possible color values. Note: In Safari (on PC) the color parameter is required. If you do not specify the color, the shadow is not displayed at all. |
inset | Optional. Changes the shadow from an outer shadow (outset) to an inner shadow |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Detalhes técnicos
Valor padrão: | Nenhum |
---|---|
Valor de retorno: | Uma String, representando a propriedade box-shadow de um elemento |
Versão CSS | CSS3 |
Páginas relacionadas
Referência CSS: propriedade box-shadow
❮ Objeto de estilo