Computer >> Computer tutorials >  >> Programming >> CSS

Adding Drop Shadow to Images using CSS3


To add drop shadow to image in CSS3, use the drop-shadow value for filter property. It has the following values −

h-shadow – To specify a pixel value for the horizontal shadow.

v-shadow – To specify a pixel value for the vertical shadow. Negative values place the shadow above the image.

blur – To add a blur effect to the shadow.

spread - Positive values causes the shadow to expand and negative to shrink.

color – To add color to the shadow

Example

<!DOCTYPE html>
<html>
<head>
<style>
img.demo {
   filter: brightness(120%);
   filter: contrast(120%);
   filter: drop-shadow(10px 10px 10px green);
}
</style>
</head>
<body>
<h1>Learn MySQL</h1>
<img src="https://www.tutorialspoint.com/mysql/images/mysql-mini-logo.jpg" alt="MySQL" width="160" height="150">
<h1>Learn MySQL</h1>
<img class="demo" src="https://www.tutorialspoint.com/mysql/images/mysql-mini-logo.jpg" alt="MySQL" width="160" height="150">
</body>
</html>

Output

Adding Drop Shadow to Images using CSS3