IE6 position:fixed 固定定位問題,positionfixed
IE6下 position:fixed失效,解決方案如下:
除了IE6的瀏覽器.top {
width: 97px;
height: 278px;
background: #e0c157;
position: fixed;
z-index: 30000;
/* 控制左右位置*/
right: 50px;
margin-bottom: 10px;
}
針對IE6使元素固定在瀏覽器的頂部
.top{
_position:absolute; _bottom:auto; _top:expression(eval(document.documentElement.scrollTop));}
針對IE6使元素固定在瀏覽器的底部
.top{ _position:absolute; _bottom:auto; _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
使用 margin-top:10px; 或者 margin-bottom:10px; 修改其中的數值控制元素的位置。
position:fixed; 閃動問題現在,問題還沒有完全解決。在用了上面的辦法後,你會發現:被固定定位的元素在滾動捲軸的時候會閃動。解決閃動問題的辦法是在 CSS 檔案中加入:
*html{ background-image:url(about:blank); background-attachment:fixed;}其中 * 是給 IE6 識別的。
效果如:
詳細請看http://loo2k.com/blog/ie6-position-fixed/