5
I have a div
who is with filter:blur()
, but I noticed that the blur
means it is inside the element. What I mean is that when you reach the box-model boundary the image of background
begins to disappear before the edge, giving the impression that the background does not occupy the whole element.
Notice the image above, see that the image is already disappearing before it even reaches the edge.
Notice the code that the two .box
has the same size, and see how the blur
does not complete the entire content. Is there any way to fix this problem?
div {float:left}
.box {
width: 300px;
height: 300px;
background-image: url(https://placecage.com/300/300);
filter: blur(5px);
}
.box2 {
width: 300px;
height: 300px;
background-color: red;
}
<div class="box"></div>
<div class="box2"></div>
The intention is for the box to look like this, with 100% of the background content with blur
Sam I think the way is maybe, but it’s not cool yet, see that by putting a BG color, there is still a contamination of the background color on the edge of the image http://prntscr.com/mzltxl there is still some adjustment in this code that can improve this problem?
– hugocsl
I don’t understand :D... if you put a background-color, you say?
– Sam
No no, I’m actually saying that Blur is still affecting the image edge. If you put a color on the body vc will see that this color is visible below the image, the Blur continues to "eat" a piece into the background of the element, note the second image of the question, see that the Blur fully picks up
– hugocsl
Then I would have to slightly enlarge the image with Transform: Scale (I edited the answer)
– Sam
Now I do! I had tried it with a margin:-5px; and tb had worked, but with Scale it might be even better, because the rendering might have helped the GPU, I can’t remember if the filter itself already activates the GPU... Anyway thanks! Tomorrow I accept pq hj already hit the haha ceiling :D
– hugocsl
I just read here, Point of reply accepted is not taxed!
– hugocsl