gpt4 book ai didi

html - 位置固定后停止重叠

转载 作者:太空宇宙 更新时间:2023-11-04 10:28:43 25 4
gpt4 key购买 nike

我试图阻止左侧 div 滚动。我已将其位置设置为固定,但现在它与正确的位置重叠。我能做些什么?我试过 position: relative 和 absolute 到正确的 div 但没有任何反应。

<div class="container-fluid">
<div class="row">
<div class="col-sm-7">
</div>
<div class="col-sm-5">
<div id="googleMap"></div>
</div>
</div>
</div>

最佳答案

col-sm-offset-7 类添加到 col-sm-5 元素。

当你使一个元素的位置absolutefixed时,它会从relativestatic流中移除> 元素,从而腾出它在该流中的空间,允许后续元素在其位置上“向上移动”(或在您的情况下离开)。

假设您使用的是 Bootstrap,您的 col div 向左浮动,因此当您固定 col-sm-7 时,它会被拉出流程col-sm-5 一直 float 到另一个元素从流程中移除之前所在的左侧。

关于html - 位置固定后停止重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36655690/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com