1
好吧,这个真的搞砸了。试着在JSfiddle中运行以下代码。如果您在任何其他浏览器中尝试它,它可以正常工作。如果你在IE6中运行它,它将无法工作。模拟IE6中可滚动div的固定位置
如何使用IE6工作?
此外,内容需要有位置:相对。
<style type="text/css">
.content {
position: relative;
}
.scrollable {
position: relative;
width: 200px;
height: 200px;
background: #333;
overflow: scroll;
}
.fixed {
position: fixed;
top: 180px;
width: 200px;
height: 20px;
background: #fa2;
}
</style>
<div class="scrollable">
<div class="content">
im scrollable<br><br>
im scrollable<br><br>
im scrollable<br><br>
im scrollable<br><br>
im scrollable<br><br>
im scrollable<br><br>
</div>
<div class="fixed">and I'm fixed</div>
</div>
我知道这不是你的问题,但是现在我们应该忘记IE 6了。也许它不需要在旧的,过时的和错误的浏览器上看起来漂亮。 =) – 2012-01-16 18:48:45
告诉我的客户谁是我的钱。 – Bill 2012-01-16 18:56:01
@DanielCastro,是的,我有一些与IE6有关的工作,因为我的客户没有预算将IE升级到大约5k的工作人员:) – 2012-01-16 19:22:41