【问题标题】:Emulating fixed positioning in scrollable div in IE6在 IE6 中模拟可滚动 div 中的固定定位
【发布时间】:2012-01-17 03:19:57
【问题描述】:

好吧,这真是一团糟。只需尝试在 JSfiddle 中运行以下命令。如果您在任何其他浏览器中尝试它,它可以正常工作。如果在 IE6 下运行,就不行了。

如何在 IE6 中使用?

另外,内容需要有 position:relative。

    <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 的时候了。也许它不需要在旧的、过时的和有问题的浏览器上看起来那么漂亮。 =)
  • 告诉我的客户,他们付钱给我。
  • @DanielCastro,是的,我有一些与 IE6 相关的工作,因为我的客户没有预算将 IE 升级到大约 5k 个工人 :)

标签: css internet-explorer-6


【解决方案1】:

position: fixed 不适用于 IE6。您可以使用 javascript 使 .fixed 在窗口滚动和调整大小时转到其“固定”位置,但它看起来不太好(它会在 js 将它带回来之前移动)

试试checking this out

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-07-24
    • 2015-12-30
    • 2015-05-04
    相关资源
    最近更新 更多