Home >Web Front-end >CSS Tutorial >How to Blur an Image Without Smudging Edges Using CSS3 Filters?
When using CSS3 filters to blur images, the edges of the image may also become blurred. This can be undesirable if you want to maintain crisp edges while creating a blur effect.
To address this issue, a clever solution involves placing the image within a
CSS Code:
img { filter: blur(5px); -webkit-filter: blur(5px); -moz-filter: blur(5px); -o-filter: blur(5px); -ms-filter: blur(5px); margin: -5px -10px -10px -5px; } div { overflow: hidden; }
Explanation:
Example:
[Live Demo](https://jsfiddle.net/NI3c4/)
HTML:
<div> <img src="path/to/image.jpg" /> </div>
Result:
The image is blurred with defined edges, as the blurred area is contained within the
The above is the detailed content of How to Blur an Image Without Smudging Edges Using CSS3 Filters?. For more information, please follow other related articles on the PHP Chinese website!