---------------------------2014.01.10补充-------------------------------css
/*对于非IE6能够这样写*/ #top{ position:fixed; bottom:0; right:20px; } /*可是IE6是不支持fixed定位的,须要另外重写*/ #top{ position:fixed; _position:absolute; top:0; right:20px; _bottom:auto; _top:expression(eval(document.documentElement.scrollTop)); } /*使用hack使IE6实现该效果,但这个东东会闪烁,须要如下代码*/ *html{ background-image:url(about:blank); background-attachment: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)||0)-(parseInt(this.currentStyle.marginBottom)||0))); } /*垂直居中*/ #top{ position:fixed; top:50%; margin-top:-50px; _position:absolute; _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight/2)); }
/* 最小宽度 */ .min_width{ min-width:300px; _width:expression(parseInt(this.clientWidth) < 300 ? "300px" : this.clientWidth); } /* 最大宽度 */ .max_width{ max-width:600px; _width:expression(parseInt(this.clientWidth) > 600 ? "600px" : this.clientWidth); } /* 最小高度 */ .min_height{ min-height:200px; _height:expression(parseInt(this.clientHeight) < 200 ? "200px" : this.clientHeight); } /* 最大高度 */ .max_height{ max-height:400px; _height:expression(parseInt(this.clientHeight) > 400 ? "400px" : this.clientHeight); }
1)ie6下 首先讲讲第一种z-index不管设置多高都不起做用状况。这种状况发生的条件有三个:一、父标签position属性为relative;二、问题标签含有浮动(float)属性。
2)全部浏览器:它只认第一个爸爸
层级的高低不只要看本身,还要看本身的老爸这个后台是否够硬。用术语具体描述为:
父标签position属性为relative或absolute时,子标签的absolute属性是相对于父标签而言的。而在IE6下,层级的表现有时候不是看子标签的z-index多高,而要看它们的父标签的z-index谁高谁低。html
/*类内部hack:*/ .header {_width:100px;} /* IE6专用*/ .header {*+width:100px;} /* IE7专用*/ .header {*width:100px;} /* IE六、IE7共用*/ .header {width:100px\0;} /* IE八、IE9共用*/ .header {width:100px\9;} /* IE六、IE七、IE八、IE9共用*/ .header {width:330px\9\0;} /* IE9专用*/ /*选择器Hack:*/ *html .header{} /*IE6*/ *+html .header{} /*IE7*/