Boîte de styleShadow Property
Exemple
Ajoutez un box-shadow à un élément div :
document.getElementById("myDIV").style.boxShadow = "10px 20px 30px blue";
Définition et utilisation
La propriété boxShadow définit ou renvoie les ombres portées d'un élément box.
Prise en charge du navigateur
Property | |||||
---|---|---|---|---|---|
boxShadow | Yes | 9.0 | Yes | 5.1.1 | Yes |
Syntaxe
Renvoyez la propriété boxShadow :
object.style.boxShadow
Définissez la propriété boxShadow :
object.style.boxShadow = "none|h-shadow v-shadow blur spread color |inset|initial|inherit"
Remarque : La propriété boxShadow attache une ou plusieurs ombres portées à la boîte. La propriété est une liste d'ombres séparées par des virgules, chacune spécifiée par 2 à 4 valeurs de longueur, une couleur facultative et un mot-clé d'encart facultatif. Les longueurs omises sont 0.
Valeurs de propriété
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 |
Détails techniques
Valeur par défaut: | rien |
---|---|
Valeur de retour : | Une chaîne, représentant la propriété box-shadow d'un élément |
Version CSS | CSS3 |
Pages connexes
Référence CSS : propriété box-shadow
❮ Objet de style