Issue
I am blurring some images with this code
img {
filter: blur(5px);
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
}
The edges of the image get blurred too though. Is it possible to blur the image, while keeping the edges defined? Like an inset blur or something?
Solution
You could put it in a <div>
with overflow: hidden;
and set the <img>
to margin: -5px -10px -10px -5px;
.
Output
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>
Answered By - ThinkingStiff
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.