CSS: Margin-top when parent's got no border

Viewed 31519

As you can see in this picture, I've got an orange div inside a green div with no top border. The orange div has a 30px top margin, but it's also pushing the green div down. Of course, adding a top border will fix the issue, but I need the green div to be top borderless. What could I do?

.body {
 border: 1px solid black;
 border-top: none;
 border-bottom: none;
 width: 120px;
 height: 112px;
 background-color: lightgreen;
}

.body .container {
 background-color: orange;
 height: 50px;
 width: 50%;
 margin-top: 30px;
}
<div class="header">Top</div>
<div class="body">
 <div class="container">Box</div>
</div>
<div class="foot">Bottom</div>

Thanks

7 Answers

Not sure how hackish this sounds, but how about adding a transparent border?

Related