I have a parent and child div, and when I add margin to the child div, it expands the parent div. How can I stop this from happening. You can see it happen here because the scroll bars appear.
I had a look at this similar question but I it doesn't seem like that answer does anything.
html, body {
height: 100%;
width: 100%;
margin: 0px;
}
.container {
background-color: orange;
height: 100%;
width: 100%;
}
.child {
background-color: green;
height: 100%;
width: 200px;
margin: 10px;
}
<div class="container">
<div class="child"></div>
</div>
I would like this to be the final output. With the Orange div being 100% height