build網(wǎng)站制作 |
【IE6】如何讓position:fixed在ie6中工作當前位置:首頁>主要服務(wù)>網(wǎng)站制作>html![]() IE6BUG之不支持position:fixed
本文所使用的技巧是用了一條Internet Explorer的CSS表達式(expression)。你不可以直接使用該表達式,因為它可能會因為緩存而不更新。解決這一點的最簡單的方式是使用
下面是樣式,把這個加在CSS里,然后按需求引用。
/*讓position:fixed在IE6下可用! */ .fixed-top/* 頭部固定 */{position:fixed;bottom:auto;top:0px;} .fixed-bottom/* 底部固定 */{position:fixed;bottom:0px;top:auto;} .fixed-left/* 左側(cè)固定 */{position:fixed;right:auto;left:0px;} .fixed-right/* 右側(cè)固定 */{position:fixed;right:0px;left:auto;} /* 上面的是除了IE6的主流瀏覽器通用的方法 */ * html,* html body /* 修正IE6振動bug */{background-image:url(about:blank);background-attachment:fixed;} * html .fixed-top/* IE6 頭部固定 */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));} * html .fixed-right/* IE6 右側(cè)固定 */{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));} * html .fixed-bottom/* IE6 底部固定 */{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)));} * html .fixed-left/* IE6 左側(cè)固定 */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));} 0
|
易勢網(wǎng)站制作,以DIV+CSS為主,js/jQuery為輔,制作利于優(yōu)化,頁面美觀的優(yōu)質(zhì)網(wǎng)站!
網(wǎng)絡(luò)策劃公司|新浪官方微博|大連網(wǎng)站建設(shè)
沈陽易勢科技有限公司 網(wǎng)站制作網(wǎng)絡(luò)營銷公司 © 2011 , All rights reserved. 公司地址:沈陽市鐵西區(qū)貴和街道建設(shè)中路15號淺草綠閣商務(wù)樓402室沈陽網(wǎng)站制作易勢最專業(yè)
遼B2-20150173-8號