Please look at the following example: https://jsfiddle.net/9wbm179c/
The margin-top:50px;
is making this ugly gap between body and .outter
. Just read the code and this message again: between body and .outter
... Isn't it should be making the gap between .inner and .outter
?
html,
body {
padding: 0;
margin: 0;
}
body {
background: #777;
}
.outter {
background: #099;
text-align: center;
}
.inner {
background: #ff0;
width: 400px;
height: 150px;
margin: 0 auto;
margin-top: 50px;
}
<div class="outter">
<div class="inner">
</div>
</div>