兼容IE6+、Chrome、FireFox的固定浮动css代码

作者:Jasmine - 2017年11月29日
<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+浏览器,固定边栏效果..

来源于: http://www.365mini.com/page/css-fixed-float-code.htm

本文作者: Jasmine

本文链接: https://www.jianbaizhan.com/article/589

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!


 请勿发布不友善或者负能量的内容。审查将对发布广告等违规信息进行处罚!