Here is the problem: When I remove backdrop-filter
, the absolute element is positioned relative to the body
, which is what I want. But if I add backdrop-filter
, it is positioned relative to root
.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
border: 3px solid red;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
#root {
border: 3px solid blue;
height: 80vh;
width: 80vw;
background-color: #46443e96;
backdrop-filter: blur(19px) saturate(180%); /* Problem Here */
}
.left {
/* display: flex; */
flex-direction: column;
width: 30%;
height: 100%;
overflow: scroll;
}
.item {
/* flex-shrink: 0; */
border: 3px solid orange;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
}
.absolute {
position: absolute;
border: 3px solid green;
width: 50px;
height: 50px;
top: 0;
left: 0;
}
</style>
</head>
<body>
<div id="root">
<div class="left">
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
<div class="absolute">absolute</div>
</div>
</div>
</body>
</html>
I don’t understand why and I need a solution.