drop-shadow() CSS Function
The drop-shadow() filter function adds a shadow that follows the shape of an element's content, including transparent areas, unlike box-shadow.
Description
The drop-shadow() CSS function applies a shadow effect to the rendered image of an element, similar to a real-world shadow cast by a light source. Unlike other filter functions such as blur() or brightness(), which change the pixels of the element itself, drop-shadow() only affects the visible pixels of the element and ignores transparent areas. This makes it particularly useful for images with transparency, icons, or elements with non-rectangular shapes, such as img elements or elements with clip-path applied.
The function allows you to specify the horizontal offset, vertical offset, blur radius, and color of the shadow. Positive horizontal offsets move the shadow to the right, while negative values move it to the left. Positive vertical offsets move it downward, and negative values move it upward. The blur radius controls the softness of the shadow edges, and the color determines its visual tone. If the blur radius is omitted, the shadow is sharp, and if the color is omitted, it defaults to currentcolor (the element's text color). Unlike box-shadow, drop-shadow() has no spread radius and no inset keyword.
A practical example of drop-shadow() is applying it to an icon with transparency to create a subtle lift effect:
.icon {
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.5));
}
Here, the shadow is offset 3px both horizontally and vertically, blurred by 5px, and has a semi-transparent black color. Unlike the box-shadow property, which only works with the element’s rectangular box, drop-shadow() respects the alpha transparency of the element, producing a more natural effect for irregular shapes.
Additionally, multiple shadows can be applied by separating each drop-shadow() with a space, similar to how background layers can stack. This allows complex shadow effects without additional markup.
Interactive Demo
Syntax
drop-shadow() = drop-shadow( [ <color>? && <length>{2,3} ] )Values
- offset-xThe horizontal offset of the shadow. Positive values move the shadow to the right, negative values to the left. Required.
- offset-yThe vertical offset of the shadow. Positive values move the shadow down, negative values up. Required.
- blur-radiusOptional. The blur radius of the shadow as a <length>. The larger the value, the softer and wider the shadow. Defaults to 0, which gives a sharp shadow. Negative values are not allowed.
- colorOptional. The color of the shadow, in any CSS color format. It can be written before or after the lengths. Defaults to currentcolor.
Example
Browser Support
The following information will show you the current browser support for the CSS drop-shadow() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
Desktop





Tablets & Mobile





