BFC外边距重叠
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>BFC外边距重叠</title>
<style type="text/css">
.box1{
width: 100px;
height: 100px;
background-color: red;
margin-bottom: 30px;
}
.box2{
width: 100px;
height: 100px;
background-color: yellow;
margin-top: 70px;
}
.parent{
/* 触发bfc */
/* display: inline-block; */
overflow: hidden;
}
</style>
</head>
<body>
<div class="parent">
<div class="box1"></div>
</div>
<div class="box2"></div>
</body>
</html>
本文来自博客园,作者:JackieDYH,转载请注明原文链接:https://www.cnblogs.com/JackieDYH/p/17634935.html