<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
.div1{
width: 100%;
height: 300px;
}
.div2{
margin: 0 auto;
width: 600px;
background: #ccc;
}
.div2 li{
float: left;
}
</style>
</head>
<body>
<div class="div1">
<div class="div2">
<ul>
<li>huiche</li>
<li>huiche</li>
<li>huiche</li>
<li>huiche</li>
</ul>
</div>
</div>
</body>
</html>
为什么给 li 设置浮动后,div的背景颜色没效了。而给li设置display:inline-block的话div的背景颜色却能显示出来
慕数据5775487