大连网站制作客服
主营业务
  • 网站制作
  • 网站维护
  • 网站推广
  • 域名空间
联系电话
联系人:尹先生
QQ:1050706570
E-mail:biz@noonenet.cn
地址:大连市甘井子区哲林北园29号
·首页 >> 设计表现 >> 解决 IE6 position:fixed 定位问题

解决 IE6 position:fixed 定位问题

  更新时间:2012-5-31 11:29:51    编辑:苗苗

 关于 position:fixed; 属性是生成绝对定位的元素,相对于浏览器窗口进行定位。元素的位置通过"left", "top", "right" 以及 "bottom" 属性进行规定。

position:fixed; 可以让网页上的某个元素固定在一个绝对的位置,即使拉动滚动条位置也不发生变化。

使元素固定在浏览器的顶部:

#top{
_position:absolute;
_bottom:auto;
_top:expression(eval(document.documentElement.scrollTop));
}

使元素固定在浏览器的底部:

#top{
_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-top:10px;
或者
_margin-bottom:10px;
修改其中的数值控制元素的位置。

position:fixed; 闪动问题
现在,问题还没有完全解决。在用了上面的办法后,你会发现:被固定定位的元素在滚动滚动条的时候会闪动。解决闪动问题的办法是在 CSS 文件中加入:

*html{
background-image:url(about:blank);
background-attachment:fixed;
}

其中
*
是给 IE6 识别的。
到此,IE6 的 position:fixed; 问题已经被解决了。

 

原载: 大连网站建设 http://www.noonenet.cn/
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出处、作者信息和本声明。否则将追究法律责任。


Tags: IE6,position:fixed,定位问题
同类文章:
· Firefox/Chrome/IE浏览器关于CSS和JavaScript的兼容性
· 针对Firefox,Opera,Safari,GoogleChrome等浏览器的CSS hack
· 锚点链接同一页面和不同页面的某个位置,解决IE6不好用
· CSS兼容性,层透明
· 如何设计注册表单,才能提升用户体验
返回新闻列表
top
本站关键字:大连网站制作 - 大连网站建设 - 大连网页制作
CopyRight © 2009-2012 No.1网络工作室 All Rights Reserved  sitemap
地址:大连市甘井子区哲林北园29号 电话:13889684613 E-mail:biz@noonenet.cn QQ:1050706570
logo