内边距的折叠
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>内边距的折叠</title>
<style>
.box1,.box2{
width: 200px;
height: 200px;
font-size: 50px;
}
.box1{
background-color: blanchedalmond;
margin-bottom: 100px;
}
.box2{
background-color: blue;
margin-top: 100px;
}
.box3{
width: 200px;
height: 200px;
background-color: cyan;
}
.box4{
width: 100px;
height: 100px;
background-color: brown;
margin-top: 100px;
}
.box5{
width: 200px;
height: 100px;
background-color: rgb(24, 179, 18);
padding-top: 100px;
}
.box6{
width: 100px;
height: 100px;
background-color: rgb(194, 22, 165);
}
.box7{
width: 200px;
height: 200px;
background-color: rgb(24, 179, 18);
border-top: 1px red solid;
}
.box8{
width: 100px;
height: 100px;
background-color: rgb(194, 22, 165);
margin-top: 100px;
}
</style>
</head>
<body>
<div class="box1"></div>
<div class="box2"></div>
<div class="box3">
<div class="box4"></div>
</div>
<br>
<br>
<br>
<br>
<br>
<div class="box5">
<div class="box6"></div>
</div>
<br>
<br>
<br>
<br>
<br>
<div class="box7">
<div class="box8"></div>
</div>
</body>
</html>