When I attempt to add margin-bottom on a div inside its parent, it seems to display as the parent's margin-top. Why is that?
HTML:
<div id="wrapper">
<div id="content">
<div id="box"></div>
</div>
</div>
CSS:
#wrapper{
border: 1px solid #F68004;
}
#content{
background-color: #0075CF;
height: 100px;
}
#box{
margin-bottom: 50px;
}
Expected Outcome:
Actual Result:
Update:
I've managed to fix this issue, but I am still unsure why the initial code didn't work. Can someone provide an explanation?
Update 2:
It appears that most responses suggest that this issue is due to margin collapse and may be similar to this situation. However, please note that I specifically set margin-bottom and not margin-top. I have researched collapsing margins but have not found any indication that margin-bottom can be interpreted as margin-top. Can anyone clarify this for me?