标签:
在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>
标签:
原文地址:http://www.cnblogs.com/theWayToAce/p/5559304.html