IE6中的position:fixed定位兼容性寫法分享
發(fā)布時間:2014-05-12 09:56:42 作者:佚名
我要評論

這篇文章主要介紹了IE6中的position:fixed定位兼容性寫法分享,需要的朋友可以參考下
非IE6下的寫法大家一般都清楚如何寫;這里就不展示了;
切入正題,以下的IE6下CSS的兼容性寫法:
/* 修正IE6振動bug */
html,* html body{background-image:url(about:blank);background-attachment:fixed;}
/* IE6 頭部固定 */
html .fixed-top{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
/* IE6 右側(cè)固定 */
html .fixed-right{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}
/* IE6 底部固定 */
html .fixed-bottom{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)));}
/* IE6 左側(cè)固定 */
* html .fixed-left{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}
不信?還不去試試?
切入正題,以下的IE6下CSS的兼容性寫法:
復(fù)制代碼
代碼如下:/* 修正IE6振動bug */
html,* html body{background-image:url(about:blank);background-attachment:fixed;}
/* IE6 頭部固定 */
html .fixed-top{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
/* IE6 右側(cè)固定 */
html .fixed-right{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}
/* IE6 底部固定 */
html .fixed-bottom{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)));}
/* IE6 左側(cè)固定 */
* html .fixed-left{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}
不信?還不去試試?
相關(guān)文章
IE 6不支持min-height或max-width等屬性的完美解決方案
IE6不支持min-height,但是實際操作中,這個屬性是非常需要的,下面為大家介紹下幾種不錯的解決方案,感興趣的朋友可以參考下2014-05-05- 針對IE6、7和FF的css樣式兼容問題,一直都是前端開發(fā)者的頭疼問題,下面為大家介紹下CSS中針對IE6、7和FF的特殊寫法,希望對大家有所幫助2014-01-07
經(jīng)典的IE6的高度問題-div默認存在3個像素高
經(jīng)典的IE6的高度問題想必大家都有遇到過吧。div默認存在3個像素高,由font-size引起的,具體的解決方法可以參考下本文2013-11-14IE6 div最小高度去除方法以及IE6div垂直居中css樣式
使用CSS定義DIV的高度的時候經(jīng)常遇到這個問題,就是當(dāng)DIV的最小高度小于一定的值以后,就會發(fā)現(xiàn)Div的高度會固定在一個值不再發(fā)生變動,下面有個不錯的示例感興趣的朋友不要2013-11-14