<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
*{margin:0; padding:0;}
#wrap{background:#00C; margin:0 auto; width:960px;}
#header{ background; #FF3300; width:100%;}
#mainbody{background:#FC0; width:100%; overflow:hidden}
.left{width:800px; height:200px; background:#000; float:left; margin-right:20px;}
.right{width:140px; height:500px; background:#690; float:left;}
#footer{background:#639; width:100%;}
</style>
</head>
<body>
<div id="wrap">
<div id="header">header</div>
<div id="mainbody">mainbody
<div class="left">left</div>
<div class="right">right</div>
</div>
<div id="footer">版權部分</div>
</div>
</body>
</html>

老師我按照課程來編寫,為什么是這個狀態
2015-06-29
粘貼了一下你的代碼看了一下具體效果,因為你的mainbody文本節點是在黃色的div里的,但是它也占據空間,綠色的div是左浮動,所以就被擠下來 了,把mainbody文字去掉就可以了~~~
去掉文本節點之前的效果和文本位置
去掉文本節點之后的效果