drop-shadow()
Published Jul 12, 2021Updated Dec 11, 2023
Contribute to Docs
Creates a drop shadow effect on an element.
Syntax
filter: drop-shadow(<offset-h> <offset-v> <blur> <color>);
<offset-h>
(required): The horizontal offset of the shadow. Negative values will move the shadow to the left.<offset-v>
(required): The vertical offset of the shadow. Negative values will move the shadow up.<blur>
(optional): The blur of the shadow. A default value of0
will create a hard shadow.<color>
(optional): The color of the shadow. If unset, the value will be thecolor
property value.
Example 1
Give the image a drop shadow offset horizontally 12px
, vertically 12px
with a blur of 5px
and a color of red
.
.banner-image {filter: drop-shadow(12px 12px 5px red);}
Example 2
Give the image a drop shadow offset horizontally -12px
, vertically -12px
with a blur of 2em
and a color of purple
.
.banner-image {filter: drop-shadow(-12px -12px 2em purple);}
The first image on the left is the original, and the image on the right has the drop-shadow
filter set at (12px 12px 5px red)
.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn CSS on Codecademy
- Career path
Front-End Engineer
Front-end engineers work closely with designers to make websites beautiful, functional, and fast.Includes 34 CoursesWith Professional CertificationBeginner Friendly115 hours - Career path
Full-Stack Engineer
A full-stack engineer can get a project done from start to finish, back-end to front-end.Includes 51 CoursesWith Professional CertificationBeginner Friendly150 hours - Free course
Learn CSS
In this CSS tutorial, you’ll learn how to add CSS to visually transform HTML into eye-catching sites.Beginner Friendly6 hours