<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
.div1{
width:200px;
height: auto;
padding: 10px 0px;
background: red;
overflow:hidden;zoom:1;
/*关键是上面这一句*/
}
.div2{
width: 100px;
height:200px;
background: blue;
margin: 0 auto;
float: left;
}
</style>
</head>
<body>
<div class="div1">
<div class="div2" ></div>
</div>
</body>
</html>
div在内部有浮动情况下不能自动撑大的问题
最新推荐文章于 2021-05-30 18:38:14 发布