This behavior is called margin collapse . Two adjacent fields will fall apart, with a higher absolute value taking precedence.
This can be defeated by dividing the fields (via padding or border by the parent) or by using position: relative in the child and adjusting it this way.
HTML:
<div class="parent"> <div class="child"></div> </div>
CSS
Normal
.parent { margin: 5px; } .child { margin: 15px; }
Filling / Boundary Solution
.parent { margin: 5px; padding: 1px; } .child { margin: 15px; }
Position: relative decision
.parent { margin: 5px; } .child { position: relative; top: 15px; }
source share