Javascript examples for CSS Style Property:boxShadow
The boxShadow property sets or gets the drop-shadows of a box element.
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. |
inset | Optional. Changes the shadow from an outer shadow to an inner shadow |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | none |
Return Value: | A String, representing the box-shadow property of an element |
CSS Version | CSS3 |
Add a box-shadow to a div element:
<!DOCTYPE html> <html> <head> <style> #myDIV {//from ww w .j a va2s . co m position: absolute; width: 100px; height: 100px; background-color: coral; color: white; } </style> </head> <body> <button onclick="myFunction()">Test</button> <div id="myDIV"> <h1>myDIV</h1> </div> <script> function myFunction() { document.getElementById("myDIV").style.boxShadow = "10px 20px 30px lightblue"; } </script> </body> </html>