Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cutting off the nasty edge of a circular blurred image

Tags:

html

css

There's a few posts about this for cutting off the edges of a square image, however none for an image that takes the shape of a cirlce.

Unfortunately the solutions expressed here do not work, because it chops off the circle.

Here's a JSFiddle trying to use the solution above: http://jsfiddle.net/3hg7ry9k/

CSS:

.fix {
     margin: -5px -10px;
}

.avatar {
    width: 128px;
    -webkit-filter: blur(5px);
    border-radius: 50%;
}

Basically, I'm trying to have a blurred circle image with crisp borders.

like image 919
Hobbyist Avatar asked Feb 02 '26 17:02

Hobbyist


1 Answers

You Should Set the blur effect to the img. and set the border-radius to the container:

http://jsfiddle.net/t1e1s5hb/

HTML

<div class="avatar">
    <img class="fix" src="http://pickaface.net/avatar/Opi51c7dccf270e0.png" width="150">
</div>

CSS

.fix {
    margin: -5px -10px;
    -webkit-filter: blur(5px);
}

.avatar {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    overflow: hidden;
}
like image 162
hmak.me Avatar answered Feb 05 '26 08:02

hmak.me



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!