To achieve the desired effect, you can use the same image enlarged multiple times (~10), overlapped with position:absolute
and a significant blur factor while managing overflow:
.card {
height: 250px;
width: 150px;
margin: 1rem;
display: inline-block;
border: 1px solid #eee;
border-radius: 6px;
}
.top-bar {
padding: 1rem;
position: relative;
overflow: hidden;
border-radius: 4px 4px 0 0;
}
.top-bar img {
width: 36px;
z-index: 1;
position: relative;
}
.top-bar img.blur {
position: absolute;
z-index: 0;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
width: 512px;
filter: blur(51.2px);
opacity: .07;
}
.card:hover img.blur {
opacity: .42;
}
<div class="card">
<div class="top-bar">
<img src="https://fastly.picsum.photos/id/10/2500/1667.jpg?hmac=J04WWC_ebchx3WwzbM-Z4_KC_LeLBWr5LZMaAkWkF68">
<img class="blur" src="https://fastly.picsum.photos/id/10/2500/1667.jpg?hmac=J04WWC_ebchx3WwzbM-Z4_KC_LeLBWr5LZMaAkWkF68">
</div>
</div>
<div class="card">
<div class="top-bar">
<img src="https://fastly.picsum.photos/id/102/4320/3240.jpg?hmac=ico2KysoswVG8E8r550V_afIWN963F6ygTVrqHeHeRc">
<img class="blur" src="https://fastly.picsum.photos/id/102/4320/3240.jpg?hmac=ico2KysoswVG8E8r550V_afIWN963F6ygTVrqHeHeRc">
</div>
</div>
<div class="card">
<div class="top-bar">
<img src="https://fastly.picsum.photos/id/1022/6000/3376.jpg?hmac=FBA9Qbec8NfDlxj8xLhV9k3DQEKEc-3zxkQM-hmfcy0">
<img class="blur" src="https://fastly.picsum.photos/id/1022/6000/3376.jpg?hmac=FBA9Qbec8NfDlxj8xLhV9k3DQEKEc-3zxkQM-hmfcy0">
</div>
</div>
To simplify the process, consider using JavaScript to dynamically duplicate the <img>
element and apply the .blur
class to it (eliminating the need to manually add two images to each card).
Note that css-filters may not be fully supported across all browsers yet.
In the provided example, blurring is achieved using SVG filters instead of CSS filters which offers slightly better browser support.