為什么mainbody會受浮動的影響?

為什么我寫的mainbody是藍色的?
這是我的代碼:
<title>無標題文檔</title>
width:100%;
}
#mainbody {<style type="text/css">
* {
? ? margin:0;
padding:0;
}
#wrap {
background:#00C;
margin:0 auto;
width:960px;
}
#header {
background:#FF3300;
? ?background:yellow;
}
.left {
width:800px;
height:200px;
background:#000;
float:left;
}
.right {
width:140px;
height:500px;
background:#690;
float:right;
}
#footer {
background:#639;
width:100%;
? ? clear:right;
}
</style>
2016-04-27
#mainbody {<style type="text/css">
以上是你的代碼,你沒有對mainbody的樣式進行設置,自然它就繼承了父類#wrap。
對mainbody進行設置就可以了
2016-04-23
因為它的子元素設置了浮動,而mainbody沒有設置相應的浮動,所以受到影響。