兼容ie6,ie7,firefox的漂浮窗完美解决方案
2010-05-25 14:27
176 查看
ie6下使用css中的动态函数或js定时器实现漂浮功能时会有闪烁现象,下面这个方法纯粹使用css,可以完美解决此问题。<
divid
=
"floatbody"style
=
"z-index:999;position:fixed;bottom:0;left:0;_position:absolute;_top:expression(documentElement.scrollTop+documentElement.clientHeight-this.offsetHeight);overflow:visible;height:43px;width:100%;text-align:center;"
>
div
>上面代码已经可以满足普通需求,唯一缺陷就是在ie6下随着滚动条滚动时该div块会随之闪动,不像firefox下表现的那般稳如泰山。要解决该问题,还需要补充2点:1:页首的规范声明应如下:(针对ie6)<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">2.为body的style属性添加如下内容:background-image
:
url
(anyname.jpg);
background-attachment
:
fixed
;
divid
=
"floatbody"style
=
"z-index:999;position:fixed;bottom:0;left:0;_position:absolute;_top:expression(documentElement.scrollTop+documentElement.clientHeight-this.offsetHeight);overflow:visible;height:43px;width:100%;text-align:center;"
>
div
>上面代码已经可以满足普通需求,唯一缺陷就是在ie6下随着滚动条滚动时该div块会随之闪动,不像firefox下表现的那般稳如泰山。要解决该问题,还需要补充2点:1:页首的规范声明应如下:(针对ie6)<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">2.为body的style属性添加如下内容:background-image
:
url
(anyname.jpg);
background-attachment
:
fixed
;
background-image:url(anyname.jpg);background-attachment:fixed;(第二点中的背景图片可以随意填写,不需要真实图片路径)本文系个人原创,更多细节详见我的博客:http://richard.cnlife.org/
相关文章推荐
- js实现图片上传前的预览,实现完美兼容Firefox3,IE6,IE7,IE8和IE9的显示问题
- ie6,ie7,firefox 不兼容及解决方案,收集
- 完美的hr-兼容各个浏览器firefox,ie6,ie7
- 完美兼容ie6,ie7,ie8以及firefox的css透明滤镜
- ie6,ie7,firefox 不兼容及解决方案,收集
- ie6,ie7,firefox 不兼容及解决方案,收集
- 完美的hr-兼容各个浏览器firefox,ie6,ie7
- ie6,ie7,firefox 不兼容及解决方案,收集
- 浏览器兼容实例:css透明滤镜-完美兼容ie6,ie7,ie8以及firefox
- ie6,ie7,firefox 不兼容及解决方案,收集
- div+css 兼容ie6 ie7 ie8 ie9和FireFox Chrome等浏览器方法
- ie6 ie7 ie8 共存以及Firefox浏览器CSS兼容写法
- 【转】CSS完全兼容IE6、IE7、IE8、IE9和firefox方法
- CSS完全兼容IE6、IE7、IE8、IE9和firefox方法 - 青羽 - 博客园
- div+css 兼容ie6 ie7 ie8 ie9和FireFox Chrome方法
- IE6,IE7,FireFox兼容CSS的解决方法及CSS差别
- CSS 和JavaScript 在ie6 ie7 ie8和Firefox下bug兼容解决记录
- 完美下拉导航条,适应ie6,ie7和firefox
- IE6,IE7,IE8,Firefox兼容的css hack问题
- 【CSS】ie6 ie7 ie8 共存以及Firefox浏览器CSS兼容写法