Position fixed will be fixed to the page's scroll position and should not be used as a child of a static element.
Instead, you should set position to absolute
on the progress bar, and position relative
on the container.
.container {
position: relative;
}
.child {
position: absolute;
width: 100%;
left: 0;
}
.container {
position: relative;
display: flex;
width: 500px;
height: 100px;
}
.left {
flex: 1;
background: blue;
}
.right {
flex: 1;
background: yellow;
}
.progress {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
background: gray;
}
<div class="container">
<div class="left">
</div>
<div class="right">
<div class="progress">I'm progress bar</div>
</div>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…