`
kk48323201
  • 浏览: 95710 次
  • 性别: Icon_minigender_1
  • 来自: 珠海
社区版块
存档分类
最新评论

完美解决IE6关于fixed的BUG,兼容IE7_IE8_IE9_FF

    博客分类:
  • CSS
阅读更多
<style>
.fixed-top /* 头部固定 */{position:fixed;bottom:auto;top:0px;}
.fixed-bottom /* 底部固定 */{position:fixed;bottom:0px;top:auto;}
.fixed-left /* 左侧固定 */{position:fixed;right:auto;left:0px;}
.fixed-right /* 右侧固定 */{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 右侧固定 */ {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 左侧固定 */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}
</style>


十分强悍的代码,要用fixed的时候直接给元素赋相应的类就可以
分享到:
评论

相关推荐

    IE6特有bug兼容性问题整理

    ### IE6特有bug兼容性问题整理 #### 1. 浮动(float)与相邻非浮动元素的表现差异 - **问题描述**: 在不同浏览器中,对于`float`元素和相邻非`float`元素的处理方式存在差异。具体表现为,在IE6中,当一个元素设置...

    DIV+CSS解决各浏览器兼容问题

    为了兼容IE6,通常需要借助JavaScript和`expression`表达式来实现固定定位的效果: ```css #ff-r { position: fixed; _position: absolute; right: 15px; top: 15px; _top: expression(eval(document....

    div+css常见兼容性问题

    此外,IE6还有一个著名的“双倍边距BUG”,当一个浮动元素设置`margin-left`时,IE6会计算两次,解决办法是: ```css div { float: left; margin-left: 10px !important; /* 解决IE6双倍边距 */ margin-left: 10...

    ExtAspNet_v2.3.2_dll

    -修正IE7下不能以下划线作为CSS中类名的前缀的BUG(feedback:Steve.Wei)。 -添加定时器控件Timer,用来定时发起AJAX请求。 +2009-09-06 v2.1.0 -Button的Pressed属性值能够正确的反映客户端的变化。 -优化...

    ExtAspNet v2.2.1 (2009-4-1) 值得一看

    -修正IE7下不能以下划线作为CSS中类名的前缀的BUG(feedback:Steve.Wei)。 -添加定时器控件Timer,用来定时发起AJAX请求。 +2009-09-06 v2.1.0 -Button的Pressed属性值能够正确的反映客户端的变化。 -优化...

    WebIM_Ajax框架

    13.Fixed 效果(固定居上/中/下、左/中/右),兼容 IE6 14.base64 编码 15.网站风格切换 16.js插件:模拟 Confirm 17.js插件:层拖拽 18.js插件:输入验证(中英文长度/正则/AJAX/自定义) 19.js插件:模拟 Title ...

Global site tag (gtag.js) - Google Analytics