Home > Article > Web Front-end > How to Achieve Defined Edges with CSS3 Blur Filter?
Achieving Defined Edges with CSS3 Filter Blur
Incorporating CSS3 filters to blur images enhances visual effects. However, the default blur filter extends beyond the image boundaries, resulting in blurred edges. To maintain defined edges while blurring the image, explore the following solution:
Solution:
Enclosing the blurred image within a
Demo:
[Image of desired output with defined edges and blurred background]
CSS:
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; }
HTML:
<div><img src="http://placekitten.com/300" /></div>
The above is the detailed content of How to Achieve Defined Edges with CSS3 Blur Filter?. For more information, please follow other related articles on the PHP Chinese website!