CSS float高度问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simple Fixed Width Rounded Corner Box</title>
<style type="text/css">
<!--
/* pretty stuff
================================== */
body {
   font: 62.5%/1.6 "Gill Sans", Futura, "Lucida Grande", Geneva, sans-serif;
   color: #666;
   background: #fff;    
}
h2 {
   font-size: 2.2em;
   font-weight: normal;
   line-height: 1;
   color: #94b767;
   margin: 0;
}
.box {
   font-size: 2em;
}
.box2 {
   font-size: 2em;
}
/* rounded corner box
================================== */
.box {
   margin-top:10px;
   width: 418px;
   background: #effce7 url(images/bottom.gif) no-repeat  left bottom;
   border:1px solid red;
}
.box h2 {
   background: url(images/top.gif) no-repeat left top;
}
.box h2 {
   padding: 10px 20px 0 20px;
}
.box p {
   padding: 0 20px 10px 20px;
   margin-bottom:0;
}
/*================================== */
.box2 {	
     float:right;现在右边那个DIV的高度正常,一旦将这里改成了float:left;右边那个div立即就增加了高度,麻烦帮我看哈是为什么。(右边那个也就是box那个DIV)         
     width: 418px;
     background: #effce7 url(images/bottom.gif) no-repeat  left bottom;
}
.box2 h2 {
     background: url(images/top.gif) no-repeat left top;
}
.box2 h2 {
     padding: 10px 20px 0 20px;
}
.box2 p {
	margin-bottom:0;
     padding: 0 20px 10px 20px;
}
-->
</style>
</head>
<body>
<div class="box2">
   <h2>Lorem Ipsum2</h2>
   <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin venenatis turpis ut quam. In dolor. Nam ultrices nisl sollicitudin sapien. Ut lacinia aliquet ante.</p>
</div>
<div class="box">
   <h2>Lorem Ipsum</h2>
   <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin venenatis turpis ut quam. In dolor. Nam ultrices nisl sollicitudin sapien. Ut lacinia aliquet ante.</p>
</div>
</body>
</html>
------解决方案--------------------为啥不把.box也加浮动?
------解决方案--------------------float: left时,高度变高是因为text的特殊性,这里不会重叠,直接接着上面的内容向下,把box撑开了(关于text的这个特点我也不是特别了解,只是遇到过这个问题)。
可以把box中的text都删掉,设置一个高度,就可以看出其实box2 和 box是重叠的.
------解决方案--------------------我如果业务需求 需要高度自动增长呢
要在最后加上clear:both
------解决方案--------------------两个box换个顺序就不出这个问题,更纠结了
------解决方案--------------------第一,这种情况必须俩个层都得设float:left;才行
第二,而且后面要加一个清除图层
我想问你是啥浏览器,在我的济览器,高度没有变化呀