代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>margin合并问题</title>
<style>
.span1{
background-color: #FFCCEE;
margin-right:50px;
}
.span2{
background-color: #FFEECC;
margin-left:50px;
}
.div1{
margin-bottom:100px;
width:600px;
height: 300px;
background-color:#FFCCEE;
}
.div2{
margin-top:100px;
width:600px;
height: 300px;
background-color:#EEFFEE;
}
</style>
</head>
<body>
<!--不需要修改
可以通过数学计算解决-->
<span class="span1">123</span>
<span class="span2">456</span>
<div class="div1"></div>
<div class="div2"></div>
</body>
</html>
margin-top与margin-bottom发生了合并。