求解:IE6 position:fixed bug (固定窗口方法)
2 回答

寶慕林4294392
TA貢獻2021條經驗 獲得超8個贊
IE6 不支持position:fixed,不能叫bug
若要讓IE6模擬position:fixed效果,可以將html,body都設置為height:100%,然后加一個wrapper當body。這樣你就可以使用position:absolute來模擬fixed的效果。你可以試試下面的css代碼
html, body { height: 100%; overflow: auto; }.wrapper { position: relative; width: 100%; height: 100%; overflow: auto; }.box { position: fixed; left: 50%; top: 180px; margin: 0 0 0 -370px; } * html .box { position: absolute; }
但是要知道,很難做到完美的模仿。在內容不確定的情況下,還是會出現一些奇怪的現象,而且會影響js對元素的控制,導致js代碼的維護難度增加。這些就等你自己去發現了。
- 2 回答
- 0 關注
- 258 瀏覽
添加回答
舉報
0/150
提交
取消