代码
html:
<div class="box1">box1</div>
<div class="box2">box2</div>
css:
.box1{
width:100px;
height:100px;
background:skyblue;
float:left;
}
.box2{
width:200px;
height:200px;
background:tomato;
}
侵占效果:
解决方法
修改box2样式(添加overflow:hidden;
):
.box2{
width:200px;
height:200px;
background:tomato;
overflow:hidden;
}
修正效果: