Style -BoxShadow- Eigenschaft
Beispiel
Fügen Sie einem div-Element einen Box-Schatten hinzu:
document.getElementById("myDIV").style.boxShadow = "10px 20px 30px blue";
Definition und Verwendung
Die Eigenschaft boxShadow legt die Schlagschatten eines Box-Elements fest oder gibt sie zurück.
Browser-Unterstützung
Property | |||||
---|---|---|---|---|---|
boxShadow | Yes | 9.0 | Yes | 5.1.1 | Yes |
Syntax
Geben Sie die boxShadow-Eigenschaft zurück:
object.style.boxShadow
Legen Sie die boxShadow-Eigenschaft fest:
object.style.boxShadow = "none|h-shadow v-shadow blur spread color |inset|initial|inherit"
Hinweis: Die Eigenschaft boxShadow fügt dem Feld einen oder mehrere Schlagschatten hinzu. Die Eigenschaft ist eine durch Kommas getrennte Liste von Schatten, die jeweils durch 2-4 Längenwerte, eine optionale Farbe und ein optionales Inset-Schlüsselwort angegeben werden. Ausgelassene Längen sind 0.
Eigenschaftswerte
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 |
Technische Details
Standardwert: | keiner |
---|---|
Rückgabewert: | Ein String, der die Box-Shadow-Eigenschaft eines Elements darstellt |
CSS-Version | CSS3 |
Verwandte Seiten
CSS-Referenz: Box-Shadow-Eigenschaft
❮ Style-Objekt