For the optimal method of clearing floating in IE7, FF, and OP, we discuss a margin problem in the CSS Forest Group and inadvertently find that overflow can also be used to clear floating. Hey hey, this method is not just easy to use, in addition, FF, OP, and IE7 are supported. From then on, we can say goodbye to the FF Floating Method with long compatibility.
The method is really simple. You only need to add the overflow attribute to the label that needs to be floating.
Css code
The Code is as follows:
Ul {
List-style: none;
Height: auto;
Margin: 0; p
Adding: 0;
Background-color: #436973;
}
Li {
Float: left;
Width: 80px;
Height: 80px;
Background-color: # 83B1DF;
}
. Demo {
Clear: both;
Border: 1px solid # FF00FF;
Margin-bottom: 5px;
}
. Overflow {
Overflow: auto;
Zoom: 1;
Background-color: #43FF73;
}
Ul {
List-style: none;
Height: auto;
Margin: 0;
Padding: 0;
Background-color: #436973;
}
Li {
Float: left;
Width: 80px;
Height: 80px;
Background-color: # 83B1DF;
}
. Demo {
Clear: both;
Border: 1px solid # FF00FF;
Margin-bottom: 5px;
}
. Overflow {
Overflow: auto;
Zoom: 1;
Background-color: #43FF73;
}
HTML code
The Code is as follows: