<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>施健</title>
<style type="text/css">
*{
margin:0;
padding: 0}
.father{
width: 556px;
height: 266px;
margin: 50px auto;
padding: 15px 20px;
border: 2px solid #666;
background:#Fc6;
}
.box1,.box2,.box3{
float: left;
width: 172px;
height: 266px;
background: #7BDFC3;
overflow: hidden;
}
.box2{
margin:0 20px;
}
</style>
</head>
<body>
<div class="father">
<div class="box1"></div>
<div class="box2"></div>
<div class="box3"></div>
</div>
</body>
</html>
当父级不给高度而子级浮动时父级的背景颜色将无法显示
原文:https://www.cnblogs.com/shijian2250/p/14035397.html