Below is a snippet ( demo on JSFiddle )
#inner {
background-color: yellow;
margin-left: 50px;
margin-bottom: 50px;
}
#outer {
background-color: red;
}
<div id="outer">
<div id="inner">
test
</div>
</div>
Run codeHide resultAs you can see from the demonstration, the element #inner
has margin-bottom
.
I expected the height to #outer
be large enough to include the outline of the marker #inner
. The output will be a red bar below the yellow bar .
However, I found that the height #outer
does not change at all, although I added a rule margin-bottom: 50px
for #inner
.
Does anyone have any ideas about this? And is there a way to ensure that the content area of the parent is large enough to hold the outline of its child field?
, , , /. .
!