I was practising positioning divs by CSS and I found out margin of div being ignored. I cannot understand why margin-top
of b2
is being ignored.
When I modified margin-bottom
of b1
, there was a space between two divs.
.b1 {
width: 100px;
height: 100px;
border: 1px solid black;
float: left;
}
.b2 {
width: 100px;
height: 100px;
border: 1px solid black;
clear: both;
margin-top: 100px;
}
<div class="b1"></div>
<div class="b2"></div>