为什么会有margin塌陷问题,好奇怪的东西,一开始以为只有margin-top的塌陷,原来margin-bottom也不行!!!!好郁闷
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
}
.container {
background-color: yellow;
}
.one {
width: 100px;
height: 100px;
background-color: pink;
margin-top: 20px;
margin-bottom: 20px;
}
.two {
width: 100px;
height: 100px;
background-color: skyblue;
margin-top: 40px;
}
</style>
</head>
<body>
<div class="container">
<div class="one">one</div>
</div>
<div class="container">
<div class="two">two</div>
</div>
</body>
</html>
https://developer.mozilla.org...
你要说为什么的话。我也只能回答“王八的屁股——龟腚(规定)”