如果我的曲子不好,请见谅!我正在使用这个 HTML 代码
HTML:
<div style="width:300px; height:300px; background-color:blue; overflow:scroll">
<div style="width:100px; height:100px; background-color:red; position:fixed"></div>
</div>
CSS:
.outer {
width:200px;
height:600px;
background-color:red;
margin:0 auto;
}
.inner {
width:50px;
border:1px solid white;
position:fixed; margin-left:150px
}
问题:我的问题是,内部 div 应该在外部 div 内保持固定。当我向下滚动页面时,内部 div 应该保持固定,但是当外部 div 结束并且页面转到下一个 div 时,固定 div 也应该与外部 div 一起移动。它不应该在其他 div 中保持固定。