<div class="header__secondary" style="height:40px; background-color:green">
nav1
</div>
<div class="header header--layout-2" style="position: sticky; top: 0; height:40px; background-color:red">
nav2
</div>
<div class="header header--layout-2" style="position: fixed; height:40px; margin-top:20px; background-color:yellow">
elm
</div>
<br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br>
<br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br></br>
如何使黄色elm
始终与黄色保持固定距离nav2
?问题是,现在如果你向下滚动之间的距离nav2
,并elm
会因为增加nav1
不知道我是否正确理解您的需求...但是,如果我知道,那应该是这样的:
<div class="header__secondary" style="height:40px; background-color:green">
nav1
</div>
<div class="header header--layout-2" style="position: sticky; top: 0; height:40px; background-color:red">
nav2
</div>
<div class="header header--layout-2" style="position: sticky; top: 45px; margin-top: 5px; height: 40px; background-color:yellow">
elm
</div>
<br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br>
<br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br><br></br></br>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句