结尾处加空div标签 clear:both
<style>
.left1 {
width: 200px;
float: left;
background-color: yellow;
padding: 15px;
}
.bac {
background-color: red;
}
.con {
width: 100%;
height: 400px;
background-color: blue; }
.clearfloat {
clear: both;
}
</style>
<body>
<header class="left1"></header>
<section class="left1 bac"></section>
<!-- 结尾处加空div标签 clear:both -->
<div class="clearfloat"></div>
<section class="con"></section>
</body>
原理:添加一个空div,利用css提高的clear:both清除浮动,让父级div