在浮动元素的父标签的伪元素选择器:after中清除浮动 - 类似于空div
<style>
.box1{
width: 100px;
height: 100px;
background-color: red;
float:left;
}
.box2{
width: 200px;
height: 200px;
background-color: green;
}
.box:after{
content: "";
display: block;
clear: both;
}
</style>
<div class="box">
<div class="box1">box1</div>
</div>
<div class="box2">box2</div>