When you need to position a fixed element relative to its parent element, it can be challenging to achieve the desired layout.
To position a fixed element relative to its parent, you can use the following CSS:
.parent {
position: relative;
transform: scale(1);
/* Display purposes only */
width: 1000px;
height: 1000px;
background: red;
}
.child {
position: fixed;
inset: 0;
/* Display purposes only */
background: blue;
}
Special thanks to the Stack Overflow user who provided this solution: Answer Link