The box-shadow property programmatically creates one or more shadows on the inside or outside of a block level element.
Overview tablenone
boxShadow
box-shadow: blur-radius (optional)
box-shadow: inset (optional)
box-shadow: offset-x (optional)
box-shadow: offset-x offset-y blur-radius color, offset-x offset-y blur-radius color
box-shadow: offset-y (optional)
box-shadow: spread-distance (optional)
inset
keyword changes the shadow to one inside the frame (as if the content was depressed inside the box). Inset shadows are drawn inside the border (even transparent ones), above the background, but below content.
box-shadow
values out one after another, separated by commas.
An example of a basic drop shadow. An outer box-shadow casts a shadow as if the border-box of the element were opaque. The shadow is drawn outside the border edge only: it is clipped inside the border-box of the element.
article {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}
An example of inner drop shadows. An inner box-shadow casts a shadow as if everything outside the padding edge were opaque. The inner shadow is drawn inside the padding edge only: it is clipped outside the padding box of the element.
article {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5) inset;
}
An example of how a positive spread distance length value affects the drop shadow. If a spread distance is defined, the shadow is expanded outward or contracted inward.
article {
box-shadow: 0 0 5px 10px rgba(0, 0, 0, 0.5);
}
Negative values cause the shadow shape to contract.
article {
box-shadow: 0 20px 5px -10px rgba(0, 0, 0, 0.5);
}
If the blur value is zero, the shadow’s edge is sharp. (A non-zero blur value indicates the resulting shadow should be blurred, such as by a Gaussian filter.)
article {
box-shadow: 0 0 0 5px rgba(0, 0, 0, 0.5);
}
If the box has a nonzero ‘border-radius’, the shadow shape is rounded in the same way. (The ‘border-image’ does not affect the shape of the box-shadow.)
article {
box-shadow: 0 0 10px rgba(0, 0, 0, 1);
border-radius: 10px;
}
An example of a multiple box-shadows. The inner shadow appears on all four sides by creating two box-shadows.
<style>
.shadow-style {
width: 100px;
height: 100px;
box-shadow: inset 30px 30px 5px green, inset -30px -30px 5px blue;
border: 10px solid yellow;
background-color: red;
}
</style>
<body>
<div class="shadow-style">
</div>
</body>
Usage
===Remarks===
See also:
Related specificationsbox-shadow
box-shadow
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4