I have the following HTML
<body>
<div class="template">
<div class="box"></div>
</div>
</body>
My CSS
.template{
height:500px;
width:1000px;
background-color:#e1bfbe;
margin:0 auto;
}
.box{
height:420px;
width:165px;
background-color:#ffffff;
margin-left:416px;
margin-right:417px;
margin-top:37px;
margin-bottom:38px;
}
Now I get the following output
but when I add float:left;
in .box
class I get the following image
only margin-top is not working without float:left;
Why should I add float:left
to get top margin for the element .box ?