After using the z-index attribute, the child element is out of the document stream, but do you still want the width to be 100% full of the parent element (no matter how the parent element is scaled)?

I want to take the child element out of the document stream with the z-index attribute, but the width still changes with the parent element. Is there a way to do that?

Css
Oct.12,2021

z-index cannot be separated from the document stream, so left:0,right:0 can be covered with non-static-positioned parent elements


Why not just set the absolute positioning of the

child elements?

.parent{
    position:relative;
}
.child{
    position:absolute;
    width:100%
}
<div class="parent">
    <div class="child"></div>
</div>
Menu