Ex : https://jsfiddle.net/q4871w6L/
.article-image {
height: 150px;
width: 238px;
-webkit-filter: grayscale(0) blur(0);
filter: grayscale(0) blur(0);
transition: .4s ease-in-out;
}
.article-image:hover {
-webkit-filter: grayscale(100%) blur(2px);
filter: grayscale(100%) blur(2px);
transition: .4s ease-in-out;
}
.ar-image {
position: relative;
width: 238px;
height: 150px;
}
.article-image > p {
display: none;
}
.article-image:hover > p {
position: absolute;
top: 40%;
display: block;
color: #ffffff;
font-size: 16px;
font-weight: bold;
width: 100%;
height: 100%;
text-align: center;
transition: .4s ease-in-out;
}
<div class="ar-image">
<div style="background: url('http://maximumwallhd.com/wp-content/uploads/2015/06/fonds-ecran-plage-palmier-12-660x330.jpg')" class="article-image">
<p>Lire plus</p>
</div>
</div>
I'm trying to blur the background when hovering but not the text on the image. How can I blur the background image without blurring the text on the image ?
Thank
If you want to remove the blur on edges, you need to wrap the hole thing and give it a width + height + overflow hidden
NOTE: Since the text is positioned absolute, I've removed it from the background container and placed it outsite.
and :hover event added for the main container ('.ar-image').
You can't blur a background image but you can blur elements or pseudo-elements.
Use the image as a background (so it's still in the CSS) of a positioned pseudo-element.
Alternatively, make a minor change to the structure and pull the text out of the image div so it's not a child and subject to the blur.