IE6下CSS position:fixed 的修正解法

來源:互聯網
上載者:User

IE6 不支援 CSS position:fixed 的 寫法, 所以需要用其他寫法達成.

網路上可以找到的解法非常多, 都列在下面的相關網頁當參考資料, 有興趣的在自行研究蘿~


IE6 對於 CSS position:fixed 的修正解法
在此直接寫我的作法:

 代碼如下 複製代碼

#id_or_class_name {
    position:fixed!important;
    _position:absolute;
    bottom:0;
    /*_bottom:-20px;*/
    _z-index:10;
    right:0;
}

修改時, 一般?g覽器修改 bottom, right, 針對 IE6 修改 _bottom, _right 等. (以上 right 重複可以共用, 就不寫在上面. (若是要出現在其他地區, 自行修改成 top / left.. 等即可.)

?: _bottom, _z-index 都是給 IE6 看的.

IE6 對於 CSS position:fixed 的修正解法2
這篇的解法我沒有測試, 但是看起來是類似的, 寫法比較簡短, 詳見: IE6 的 position:fixed Hack, 下述摘錄自此篇解法:

 代碼如下 複製代碼

html, body {height:100%; overflow: auto;}
div {position:absolute;}
body>div {position:fixed;}

?: 前兩行是針對 IE6, 最後那一行就是給一般的?g覽器.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.