求教,为什么box1块元素会跟box2块元素有重叠

<!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{width:960px;;margin:0 auto;}

.mainbody{width:100%;height:400px;background:#FC0;overflow:hidden;}

.box1{width:130px;height:50px;background:red;float:left;}

.box2{width:330px; height:150px;background:blue;}

.box3{height:50px;background:purple; }

 

</style>

</head>


<body>

<div id="wrap">

<div class="mainbody">

<div class="box1">盒子1</div>

<div class="box2">盒子2</div> 

<div class="box3">盒子3</div> 

</div>

</div>

</body>

</html>


qq_红豆馅儿_0
浏览 1221回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP