相信每个前端开发者都和我一样受着IE6的折磨...今天这篇文章帮助开发者解决一个开发中常见的IE6兼容问题。也许你觉得说现在谁还用IE6 啊?但通过本人所运营的几个网站的Google Analytics得到的数据,通过IE6访问的人数比例高达40%多,其中一个传统行业更是达到了60%左右(IE8:20%、IE7:10%),自己 汗一个。(上面提到的数据的日期是:2010/7/12)
废话不说了,切入正题
核心CSS代码:
html { _background-image: url(about:blank); /* 阻止闪动 in IE6 , 把空文件换成about:blank , 减少请求 */ _background-attachment: fixed; /* prevent screen flash in IE6 */ } body { background-attachment: scroll; } /* 你的图层 */ #base_wrapper { position: fixed; z-index: 9999999; bottom: 0; width: 100%; _position: absolute; _top: expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight -this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0) -(parseInt(this.currentStyle.marginBottom,10)||0))); }
核心html代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-cn" xml:lang="zh-cn"> <head> <title>ice6 IE6方案</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> </head> <body> <div id="box"></div> <div id="base_wrapper">钱运来|snsgou.com - 随便弄点东西进来吧,这个方案我感觉比开心网和人人网用js控制的方案好,起码不用去用fadeIn、fadeOut去修复抖动</div> </body> </html>
这里有个demo,大家可以自行下载(115网盘下载),随意使用。