HTML
<div class='parent'>
<div class='child'>
Hi
</div>
</div>
CSS
.parent {
background-color: #e5e5e5;
}
.child {
background-color: #999999;
margin: 20px;
}
When this renders, the top and bottom margin on the child div is missing.
After applying the following styles to the .parent
class, margins reappear. Why is this?
.parent {
margin: -1px;
padding: 1px;
}