div
{
margin:10px 0px 20px 0px;
border:1px solid green;
height:30px;
}
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
If you look at my above code, I have applied margin-top
10px and margin-bottom
20px. I am expecting the output like each div should have the margin:30px
(20px from prev div + 10px from current div) like how padding is working. But I am getting only 20px gap? Why?