I have a div.outer
and inside a div.inner
, both with position: absolute;
and backdrop-filter: blur(8px);
.
https://jsbin.com/nihakiqocu/1/edit?html,css,output
Safari (left) gives the desired result – both divs blur what's behind them.
Chrome (right), however, only applies the blur of div.outer
:
I have a solution: adding another div inside div.outer
and moving backdrop-filter: blur(8px);
to that new div.
However, I would appreciate a solution that doesn't require changing the DOM from the first jsbin. Also, does anybody know what is causing this – is it a Chrome bug?
https://jsbin.com/rasudijame/1/edit?html,css,output
PS: it works on iOS's Chrome, but not on Android's Chrome and also not on Mac OS's Chrome
CSS Backdrop Filter is Fully Supported on Google Chrome 95. If you use CSS Backdrop Filter on your website or web app, you can double-check that by testing your website's URL on Google Chrome 95 with LambdaTest. The features should work fine.
The backdrop-filter CSS property lets you apply graphical effects such as blurring or color shifting to the area behind an element. Because it applies to everything behind the element, to see the effect you must make the element or its background at least partially transparent.
Place the backdrop filter on css pseudo element. This allows nested backdrop filters. Also you can use z-index: -1;
to position your backdrop behind your elemets
div {
height: 100px;
width: 100px;
}
.wrapper {
position: absolute;
}
.outer, .inner {
position: relative;
}
.outer::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
}
.outer {
background: rgba(255, 0, 0, .5);
}
.inner::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
}
.inner {
background: rgba(0, 0, 255, .5);
top: 50px;
left: 50px;
}
main {
position: relative;
}
<main>
<div class="wrapper">
<div class="outer">
<div class="inner"></div>
</div>
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus in id quos, est voluptatibus minus porro sunt totam quod commodi odit maxime similique, dolorum aut quo atque. Deleniti, voluptas animi.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus in id quos, est voluptatibus minus porro sunt totam quod commodi odit maxime similique, dolorum aut quo atque. Deleniti, voluptas animi.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus in id quos, est voluptatibus minus porro sunt totam quod commodi odit maxime similique, dolorum aut quo atque. Deleniti, voluptas animi.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus in id quos, est voluptatibus minus porro sunt totam quod commodi odit maxime similique, dolorum aut quo atque. Deleniti, voluptas animi.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus in id quos, est voluptatibus minus porro sunt totam quod commodi odit maxime similique, dolorum aut quo atque. Deleniti, voluptas animi.</p>
</main>
And here is codepen
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With