分类
1.解决同向重叠的方法:
(1)在最外层的div中加入overflow:hidden
(2)在最外层加入padding:1px;
(3)在最外层加入:border:;
2.异向重叠问题:
float:left
异向重叠解决方法
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
margin: 0 auto;
padding: 0px;
}
.big{
width: 500px;
height: 150px;
background-color: green;
margin-bottom:60px ;
}
.lite{
width: 100px;
height: 50px;
border: 2px red solid;
margin-top:30px ;
float: left;
}
</style>
</head>
<body>
<div class="big">1</div>
<div class="lite">0</div>
</body>
</html>