/* 通过overflow的方式 */02 |
.overflow-clear{ |
03 |
overflow:auto;/*或者 hidden,scroll,不包括visible */
|
04 |
_height:1%; /*设置高度是为了ie6获取haslayout */
|
05 |
} |
06 |
/* display 的方式*/ |
07 |
.display-clear{ |
08 |
display:inline-block;
|
09 |
} |
10 |
/* position的方式 */ |
11 |
.position-clear{ |
12 |
position:absolute;
|
13 |
} |
14 |
/* 浮动方式 */ |
15 |
.float-clear{ |
16 |
float:left; /*或者right,不是none就行*/
|
17 |
} |
18 |
/*zoom 的方式*/ |
19 |
.zoom-clear{ |
20 |
zoom:1;/* only for IE6.7 因为他们haslayout,ie8以后和标准浏览器都弱化了haslayout */
|
21 |
} |
22 |
/*after伪类+content方式*/ |
23 |
.clearfix:after { |
24 |
content: ".";
|
25 |
display: block;
|
26 |
height: 0;
|
27 |
clear: both;
|
28 |
visibility: hidden;
|
29 |
} |
30 |
/* Hides from IE-mac \*/ |
31 |
.clearfix {height: 1%;}
|
32 |
/* End hide from IE-mac */ |