This is one of the cases of a stranger turning a margin - two elements of the block level, vertical fields will always collapse in a normal flow. The two elements in this case are <body> and <h2> . If you remove <h2> from the normal flow (float, absolutely position) or change its display to inline-block , you will see that the fields will not be destroyed and will be "respected" using <body>
http://jsfiddle.net/ZqeED/2/
From 2.1 Spec :
"If the fields of an element are collapsed with the top edge of the parent, the top border edge of the field will be the same as the parent."
This explains why the upper border on <h2> adds a space on <body> - as mentioned earlier, if you had to swim, absolutely position or change to display: inline-block; the edge of the upper edge <h2> will be the same as the border with the parents, and the “space” will disappear:
http://jsfiddle.net/ZqeED/4/
source share