如果对foot做clear:both会怎么样?
另外一种方法,对right做float:right,然后对后面foot做clear:both得到的效果感觉差不多,但是mainbody颜色自己换了。这是为什么?
另外一种方法,对right做float:right,然后对后面foot做clear:both得到的效果感觉差不多,但是mainbody颜色自己换了。这是为什么?
2016-05-09
<!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:0px;
padding:0px;
}
.floatleft{
float:left;
}
.floatright{
float:right;
}
.floatclear{
clear:both;
}
#warp{
background:#CCC;
width:960px;
margin:0px auto;
}
#header{
background:red;
}
#mainbody{
background:green;
}
#footer{
background:pink;
text-align:center;
}
.box{
background:yellow;
}
</style>
</head>
<body>
<div id="warp">
<div id="header">头部</div>
<div id="mainbody">
<div class="box floatleft">
left
</div>
<div class="box floatright">
right
</div>
</div>
<div class="floatclear"></div>
<div id="footer">版权部分</div>
</div>
</body>
</html>举报