Open In App

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:

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:


Article Tags :