I have created a HTML5 <header>
element which I want to stick to the top of the page. Following that header, a <section>
element is supposed to display content.
For the section
element to be aligned to the bottom of the header I have assigned it a margin-top: 4em
CSS rule, which results in a strange effect: The header
element is now displayed with a top margin of 4em, too:
https://jsfiddle.net/n5vzgLme/1/
I have tested this with several browsers. They all display the same effect.
When I add any arbitrary text to the body (e.g. "xx" in front of the <header>
element) everything works fine. But when I then delete the text again, the odd behaviour re-occurs.
Why does this happen? AFAIK, the header
element should not be influenced by styles of a succeeding element.