兼容IE6+、Chrome、FireFox的固定浮动css代码
<div style="height: 1500px">模拟正文内容,以便显示滚动条</div> <div class="fixedfloat">该标签固定浮动</div>
/* body容器设置 */ body { /* IE6中需要为body添加如下两个样式属性,才能完美实现固定浮动 */ _background-attachment: fixed; _background-image: url(about:blank); } /* 固定浮动 */ .fixedfloat { position: fixed; _position: absolute; /* 兼容IE6 */ right: 0; bottom: 20px; width: 30px; z-index: 99; /* 兼容IE6,_top属性的表达式可能根据浮动的位置不同而所有不同,请自行更改 */ _bottom: auto; _top: expression( document.documentElement.scrollTop + document.documentElement.clientHeight - this.offsetHeight - 20 ); }
以上代码兼容ie6+浏览器,固定边栏效果..
本文作者: Jasmine
本文链接: https://www.jianbaizhan.com/article/589
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!