Maybe when you do a Web page, you find that the elements in a block are applied to float, and the height of the box is not measured by the height of the floating object.
The height of the outer frame is not the height of the content element after the float is used in the city's list of cities in the figure:
How to solve this problem? After discovery can use overflow to solve! method is to add the following code to the parent element
Overflow:auto; Zoom:1;
Overflow:auto is a highly adaptive, zoom:1, compatible IE6, and can be resolved in a height:1% way.
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en"
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
Problems after <title>float floating </title>
<style>
* {padding:0; margin:0;}
body {font-size:12px; line-height:150%;}
UL {List-style:none;}
. container {width:700px; margin:0 auto;}
. Header,. footer {height:60px; background: #99CC66; margin-bottom:6px; font-size:18px; font
-weight:bold;}
. Main {}
. left {float:left; width:200px;}
. sidepanel {border:1px solid #CC6600; margin-bottom:8px;}
. sidepanel h2 {font-size:12px; background: #CC6600; height:24px; line-height:24px; text-
indent:20px; Color: #fff;}
. city {padding:6px 0px; overflow:auto; zoom:1;}
. City Li {float:left; width:35px; text-align:center;}
. right {margin-left:200px; background: #CCCC66; height:240px;}
. hotinfo {PADDING:6PX}
. clearfloat {clear:both;height:0;font-size:1px;line-height:0px}
</style>
<body>
<div class= "container" >
<div class= "header" >header</div>
<div class= "main" >
<div class= "left" >
<div class= "Sidepanel" >
<h2> City Navigation </h2>
<ul class= "City" >
<li> Beijing </li>
<li> Shanghai </li>
<li> Tianjin </li>
<li> Nanjing </li>
<li> Guangzhou </li>
<li> Chongqing </li>
<li> Jinan </li>
<li> Hangzhou </li>
<li> Zhengzhou </li>
<li> Beijing </li>
<li> Shanghai </li>
<li> Tianjin </li>
<li> Nanjing </li>
<li> Guangzhou </li>
<li> Chongqing </li>
<li> Jinan </li>
<li> Hangzhou </li>
<li> Zhengzhou </li>
</ul>
</div>
<div class= "Sidepanel" >
<h2> Popular Articles </h2>
<ul class= "Hotinfo" >
<li> This month 20th, the arrival of Japan must leave fingerprints </li>
<li> This month 20th, the arrival of Japan must leave fingerprints </li>
<li> This month 20th, the arrival of Japan to stay <font color= "#43FF73" > Fingerprint </font></li>
<li> This month 20th, the arrival of Japan must leave fingerprints </li>
<li> This month 20th, the arrival of Japan must leave fingerprints </li>
<li> This month 20th, the arrival of Japan must leave fingerprints </li>
<li> This month 20th, the arrival of Japan must leave fingerprints </li>
<li> This month 20th, the arrival of Japan must leave fingerprints </li>
<li> this month 20th, the arrival of Japan to leave fingerprints </li>
</ul>
</div>
</div>
<div class= "right" > Right-hand content </div>
</div>
<br class= "clearfloat"/><!--used to clear floating elements-->
<div class= "Footer" >footer</div>
</div>
</body>
</html>