HTML IE6 纯CSS 解决 position fixed 的问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <style type="text/css"> .ie6fixed {border: 1px solid red; padding: 5px;} /* 修正IE6振动bug */ * html,* html body{background-image:url(about:blank);background-attachment:fixed} .ie6fixedLT{position:absolute;left:expression(eval(document.documentElement.scrollLeft));top:expression(eval(document.documentElement.scrollTop))} .ie6fixedRT{position:absolute;right:expression(eval(document.documentElement.scrollLeft));top:expression(eval(document.documentElement.scrollTop))} .ie6fixedLB{position:absolute;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)))} .ie6fixedRB{position:absolute;right:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)))} html>body .ie6fixedLT{position:fixed;left:0;top:0} html>body .ie6fixedRT{position:fixed;right:0;top:0} html>body .ie6fixedLB{position:fixed;left:0;bottom:0} html>body .ie6fixedRB{position:fixed;right:0;bottom:0} </style> </head> <body> <div class="ie6fixedLT ie6fixed">IE6完美兼容position:fixed1</div> <div class="ie6fixedRT ie6fixed">IE6完美兼容position:fixed2</div> <div class="ie6fixedLB ie6fixed">IE6完美兼容position:fixed3</div> <div class="ie6fixedRB ie6fixed">IE6完美兼容position:fixed4</div> <div style="height: 3000px;"></div> </body> </html>
效果图:
相关推荐
yaodilu 2020-08-03
lanzhusiyu 2020-07-18
lcqin 2020-08-11
小仙儿 2020-06-25
xiaohuli 2020-06-11
CaiKanXP 2020-06-09
songfens 2020-06-08
CSSEIKOCS 2020-05-19
aSuncat 2020-05-10
Phoebe的学习天地 2020-05-09
nicepainkiller 2020-05-05
amwayy 2020-05-01
AlisaClass 2020-04-14
coulder 2020-04-08
wangjie 2020-02-26
xiaohuli 2020-02-23
福叔 2020-02-16