How can I make a smooth blur as smooth as a gradient from transparent to dark?
.img {
background: url(https://4kwallpapers.com/images/walls/thumbs_2t/13551.jpg);
background-size: cover;
background-position: center;
width: 500px;
height: 300px;
position: relative;
}
.img .shadow {
content: "";
height: 150px;
bottom: 0;
width: 100%;
position: absolute;
pointer-events: none;
left: 0;
background: linear-gradient( 360deg, rgb(0 0 0 / 100%) 0%, rgba(255, 255, 255, 0) 100%);
backdrop-filter: blur(10px);
}
<div class="img">
<div class="shadow"></div>
</div>
3
Answers
You could look at layering multiple elements over each other. The first layer is the tallest, least blurred, such that its blur is less discernible with the original image. We can then layer more elements on top that increase in blur but are shorter, so that the stronger blur works its way down the image. We "blend" the layers together with the
mask
.Of course, adjust parameters to taste:
Combine mask with background
You can use mask (in the code snippet, for removing the blur filter, hover on the image):