I have this code:
<div class='block'>
<div class='container'></div>
</div>
.block {
display: block;
height: 100px;
width: 100px;
background: black;
}
.container {
display: block;
width: 30px;
height: 30px;
background: red;
margin: 50px;
}
I can not understand why margin does not work inside the block?
JsFiddle: https://jsfiddle.net/39yy7a0q/
and
. Block level elements do not sit inline but break past them. By default (without setting a width) they take up as much horizontal space as they can. DEMO: jsfiddle.net/39yy7a0q/11
– Waqar Oct 01 '15 at 09:20