- <style>
- .aa{height:2000px;width:40px;background:#eee;}
- .bb{width:50px;height:80px;background:red;float:right;
- position:fixed !important; top/**/:0px;
- position:absolute; z-index:100; top:expression(offsetParent.scrollTop+20);right:20px;
- </style>
- <div class="aa">
- 我是不动的。
- <script>for(var i=0;i<99;i++){document.write(i+"<br>");}</script>
- <div class="bb">move</div>
- </div>
悬停效果 静止不动 不随滚动条滚动 纯css实现
最新推荐文章于 2023-03-14 15:34:33 发布
本文介绍了一种使用CSS实现元素固定位置的方法,通过结合使用绝对定位和固定定位,可以让一个元素在页面滚动时保持相对位置不变,并且能够根据页面滚动进行微调。
1294

被折叠的 条评论
为什么被折叠?



