Newbie_小白
没有都对的别人,也没有全错的自己,至少要有自己的坚持,无关他人、无关外物!
在div的外面添加父级div并设置 padding-bottom: 10px;

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>

.clear {
zoom: 1;
/*iE 6;*/
}

.clear:after {
content: "";
display: block;
clear: both;
}

.wrap {
padding-bottom: 10px;
}

#div1 {
width: 100px;
height: 100px;
background: red;
float: left;
}

#div2 {
width: 200px;
height: 100px;
background: yellow;
}
</style>
</head>
<body>
<div class="wrap clear">
<div id="div1"></div>
</div>
<div id="div2"></div>

</body>
</html>
posted on 2016-06-04 18:30  Newbie_小白  阅读(204)  评论(0编辑  收藏  举报