CSS | drop-shadow() Function
The drop-shadow() function is an inbuilt function which is used to apply a filter to the image to set the shadow of the image. The drop-shadow() function creates a blurred shadow in a given offset and color.
Syntax:
drop-shadow( offset-x offset-y blur-radius spread-radius color )
Parameters: This function accepts five parameters as mentioned above and described below:
- offset-x: This parameter sets the horizontal offset of an image. The positive value creates the offset to the right side and negative value creates the offset to the left side.
- offset-y: This parameter sets the vertical offset of an image. The positive value creates the offset to the bottom side and negative value creates the offset to the top side.
- blur-radius: It sets the value of blur radius. It is an optional parameter.
- spread-radius: It sets the value of spread radius. It is an optional parameter.
- color: It sets the color of drop shadow. Its optional parameter.
Below examples illustrate the drop-shadow() function in CSS:
Example 1:
<!DOCTYPE html> <html> <head> <title>CSS drop-shadow() Function</title> <style> h1 { color:green; } body { text-align:center; } .drop_shadow_effect { filter: drop-shadow(10px 10px 10px yellow) } </style></head> <body> <h1>GeeksforGeeks</h1> <h2>CSS drop-shadow() function</h2> <img class="drop_shadow_effect" src= alt="GeeksforGeeks logo"> </body> </html> |
Output:
Example 2:
<!DOCTYPE html> <html> <head> <title>CSS drop-shadow() Function</title> <style> h1 { color:green; } body { text-align:center; } .drop_shadow_effect { filter: drop-shadow(-10px -10px 20px yellow) } </style></head> <body> <h1>GeeksforGeeks</h1> <h2>CSS drop-shadow() function</h2> <img class="drop_shadow_effect" src= alt="GeeksforGeeks logo"> </body> </html> |
Output:
Supported Browsers: The browsers supported by drop-shadow() function are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Safari
- Opera


