This applies to how fields overlap and how certain properties make them contain. If you place 2x divs on the page, both with 100px margins, the distance between these divs will be 100px. Not 200px. This is because fields are allowed to overlap other fields. This is how fields work. It's good.
But if you put a div inside another div, both with fields, then these fields also overlap. Fields of child elements overlap the parent element.
But some properties - the border, as you discovered, but also the addition and overflow - force the parent to contain the fields of their child element instead of overlapping them.
I am sure that someone can give a more technical explanation, but I am thinking about what is happening.
Here is a simplified example: http://jsbin.com/ukodus/2/
Remove // in front of any of the CSS lines to see the effect.
"This behavior is called a crash. Only the upper and lower margins collapse, not left and right." - @cimmanon
source share