解决IE6不支持position:fixed固定定位的bug(转载范鸭)

http://blog.funya.in/csscss3/ie6-fixed-bug/

在IE6中实现 position:fixed; 的办法:

浏览器头部固定
.fixed_top {
	position:fixed;
	top:0px;
}
* html .fixed_top  /* IE6 头部固定 */{
	position:absolute;
	bottom:auto;
	top:expression(eval(document.documentElement.scrollTop));
}
浏览器底部固定
.fixed_bottom{
	position:fixed;
	bottom:0px;
}
* 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)));
}

这两段代码只能实现在最底部或最顶部,再配合margin可控制元素的位置

另外还有两个,左侧固定和右侧固定
.fixed_left {position:fixed;right:auto;left:0px;}
* html .fixed_left /* IE6 左侧固定 */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft));}
 
.fixed_right {position:fixed;right:0px;left:auto;}
* 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));}

IE6抖动问题的解决

在实现页面滚动的时候,被固定定位的元素在IE6会出现闪动现象.

解决方法:
* html,* html body {
	background-image:url(about:blank);
	background-attachment:fixed;
}

.* html,* html body {
	_text-overflow:ellipsis;
}
时间: 2024-08-06 16:06:20

解决IE6不支持position:fixed固定定位的bug(转载范鸭)的相关文章

解决IE6浏览器下position:fixed固定定位问题

2010年4月15日 像你所遇到的问题一样, IE6浏览器有太多的bug让制作网页的人头疼.这篇文章介绍的是介绍的是如何解决IE6不支持position:fixed;属性的办法.如果我们需要做某个元素始终位于浏览器的底部,不会因为浏览器窗口的缩放和滚动条的滚动而变化,那个肯定是想到的用position:fixed生成绝对定位,只要设置这个CSS属性就能达到刚刚的需求.当其他浏览器都正常显示的时候,只有IE6不那么完美.该元素的位置是通过"left", "top",

解决IE6不支持position:fixed属性

最近在优化网站浮动广告时候遇见了IE6不支持position:fixed属性.上网收集了一下解决方案 比较好的方案就是利用css表达式进行解决 补充:CSS Expression (CSS 表达式),是一种使用动态设置 CSS 属性的方式,并且被 IE5 以上的版本所支持,但是 IE8 的标准模式已不再支持 CSS 表达式了 IE7和以上的浏览器都支持position:fixed: 之前写过一篇介绍过固定页脚的文字,那时候没在ie6下测试 方法一 <!--[if IE 6]> <styl

完美解决IE6不支持position:fixed的bug【转】

废话不多说,先看一下下面这段代码: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>IE6 position:fixed bug</title> <style> *{padding:0;margin:0} p{heigh

解决IE6不支持position:fixed的Bug

/* 除IE6浏览器的通用方法 */ .ie6fixedTL{position:fixed;left:0;top:0} .ie6fixedBR{position:fixed;right:0;bottom:0} /* IE6浏览器的特有方法 */ /* 修正IE6振动bug */ * html,* html body{background-image:url(about:blank);background-attachment:fixed} * html .ie6fixedTL{position:

让IE6也支持position:fixed

众所周知IE6不支持position:fixed,这个bug与IE6的双倍margin和不支持PNG透明等bug一样臭名昭著.前些天遇到了这个问题.当时就简单的无视了IE6,但是对于大项目或商业网站,如果有用到这个属性的时候,是不可能直接无视的.涞水县梁以纸业 如何让position:fixed在IE6中工作呢? 本文所使用的技巧是用了一条InternetExplorer的CSS表达式(expression).你不可以直接使用该表达式,因为它可能会因为缓存而不更新.解决这一点的最简单的方式是使用

关于ie6 不支持position:fixed的问题

css中有position: fixed;可以直接用.IE6确不支持,解决办法: * html,* html body{background-image:url(about:blank);background-attachment:fixed;} .top-nav-wrap-fix{position: fixed; top:0; _position:absolute;_top:expression_r(eval_r(document.documentElement.scrollTop)); le

如何在IE6下实现position:fixed效果

如何在IE6下实现position:fixed效果:建议:尽可能的手写代码,可以有效的提高学习效率和深度.由于IE6并不支持position:fixed,所以导致很多好的效果都无法实现,但是在IE6下并不是不能够实现此中效果,下面就通过一段实例介绍一下如何实现此种效果.代码实例如下: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="autho

两种解决IE6不支持固定定位的方法

有两种让IE6支持position:fixed1.用CSS执行表达式 *{margin:0;padding:0;} * html,* html body{ background-image:url(about:blank); background-attachment:fixed; } * html .fixed{ position:absolute; bottom:auto; top:expression(eval(document.documentElement.scrollTop+ doc

解决 IE6 position:fixed 固定定位问题

实现<div id="ad"></div>固定在窗口左下角 一般的 position:fixed; 实现方法#ad{ position:fixed; bottom:0; left:0px;} 在 IE6 中实现 position:fixed; 的办法#ad{ position:fixed; bottom:0; left:0px; _position:absolute; _bottom:auto; _top:expression(eval(document.doc