我试着去移动一个div另一个DIV中了一点,但是当我使用CSS移动一个div垂直向下
margin-top: 10px;
这使得在顶部有一个白色的差距。继承人的HTML:
<div id="topb">
<div id="selection">
</div>
</div>
而且继承人的CSS:
#topb {
background: url(images/tomato-background.jpg) no-repeat fixed;
background-size: cover;
height: 100%;
width: 101%;
margin-left: -10px;
}
#selection {
background-color: #4d4d4d;
width: 60%;
height: 500px;
margin: auto;
margin-top: 40px;
}
看起来你在#selection中有一个40px的页边距。您的保证金顶部10px在哪里? – Joel