Blur part of an image with CSS
I have set the overflow
property of the outer div
to hidden
and the margin-right
of the inner one to -1
and it worked like a charm.
#image {
...
overflow: hidden;
}
#image .blur {
...
margin-right: -1px;
}
Here is the working example in JSFiddle.
#image {
width: 940px;
height: 360px;
overflow: hidden;
background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Nuvola_wikipedia_icon.png/240px-Nuvola_wikipedia_icon.png');
}
#image .blur {
background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/e/e3/Nuvola_wikipedia_icon.png/240px-Nuvola_wikipedia_icon.png');
background-position: center right;
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-o-filter: blur(3px);
-ms-filter: blur(3px);
filter: blur(3px);
filter: blur(3px);
float: right;
height: 100%;
width: 360px;
margin-right: -1px;
}
<div id="image">
<div class="blur"></div>
</div>