drop-shadow()
Quick Summary for drop-shadow()
The drop-shadow() CSS function applies a drop shadow effect to the input image. Its result is a <filter-function>.
Code Usage for drop-shadow()
drop-shadow(offset-x offset-y blur-radius color) 
More Details for drop-shadow()

drop-shadow()

The drop-shadow() CSS function applies a drop shadow effect to the input image. Its result is a <filter-function>.

A drop shadow is effectively a blurred, offset version of the input image's alpha mask, drawn in a specific color and composited below the image.

Note: This function is somewhat similar to the box-shadow property. The box-shadow property creates a rectangular shadow behind an element's entire box, while the drop-shadow() filter function creates a shadow that conforms to the shape (alpha channel) of the image itself.

Syntax

drop-shadow(offset-x offset-y blur-radius color) 

The drop-shadow() function accepts a parameter of type <shadow> (defined in the box-shadow property), with the exception that the inset keyword and spread parameters are not allowed.

Parameters

offset-x offset-y (required)

Two <length> values that determine the shadow offset. offset-x specifies the horizontal distance, where negative values place the shadow to the left of the element. offset-y specifies the vertical distance, where negative values place the shadow above the element. If both values are 0, the shadow is placed directly behind the element.

blur-radius (optional)

The shadow's blur radius, specified as a <length>. The larger the value, the larger and more blurred the shadow becomes. If unspecified, it defaults to 0, resulting in a sharp, unblurred edge. Negative values are not allowed.

color (optional)

The color of the shadow, specified as a <color>. If unspecified, the value of the color property is used.

Examples

Setting a drop shadow using pixel offsets and blur radius

/* Black shadow with 10px blur */ drop-shadow(16px 16px 10px black) 

Setting a drop shadow using rem offsets and blur radius

/* Reddish shadow with 1rem blur */ drop-shadow(.5rem .5rem 1rem #e23) 

Specifications

Specification
Filter Effects Module Level 2 # funcdef-filter-drop-shadow

See also

<filter-function> CSS box-shadow property blur() brightness() contrast() grayscale() hue-rotate() invert() opacity() saturate() sepia()

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)Français日本語中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
In this case my anchor this week becomes driving almost 2hrs outside of Atlanta to one of my favorite hard core gyms in the world.. MetroFlex aka The Dungeon. The gym owners turn the heat way up so it becomes a fun sweat box and the gym members just watch from afar and leave me alone. I happily drive myself long distances to find MY ANCHOR. Our anchor allows us to have balance, focus and be as productive as possible. And if you're in the middle of a heavy set and your headphones start to fall off your head, like mine did here.. well.. f*ck the headphones. Let em break and fall. You can always get a new pair, but the iron ain't ever gonna lift itself.
Unknown
Random CSS Property

inherits

Experimental: This is an experimental technologyCheck the Browser compatibility table carefully before using this in production.
inherits (@property) css reference