Home > Article > Web Front-end > Add shadow to image using CSS3
To add a drop shadow to an image in CSS3, use the drop shadow value of the filter property. It has the following values -
h-shadow – Specifies the pixel value of the horizontal shadow.
v-shadow > – Specifies the pixel value of the vertical shadow. Negative values place the shadow above the image.
Blur – Adds a blur effect to shadows.
Diffusion - Positive values make the shadow expand, negative values make the shadow shrink.
Color – Adding Color to Shadows
Live Demonstration
<!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>
The above is the detailed content of Add shadow to image using CSS3. For more information, please follow other related articles on the PHP Chinese website!