三个盒子a,b,c;b在a里面,我调了b的margin-top为300px,想要让b距离顶部300,但是为什么a会跟着一起动?
代码
<style>
*{
padding: 0;
margin: 0;
}
.c{
position: fixed;
width: 100%;
height: 80px;
top: 0px;
background-color: green;
}
.a{
width: 700px;
height: 3000px;
background-color: pink;
margin: 0 auto;
}
.b{
width: 200px;
height: 200px;
background-color: yellow;
margin-top: 200px;
}
</style>
</head>
<body>
<div class="c"></div>
<div class="a">
<div class="b"></div>
</div>
</body>