In this example, why doesn’t the fixed #header (the at the top) start at the top of the page, but in this example it does?
The only difference is that i changed the “margin” of #content to “padding” instead (repsectively).
So why does this tiny change have a huge impact? How do I put the fixed #header at the top of the page while still using “margin” for the #content?
It’s because of collapsing margins.
In this case, the
margincan push down the#header(that hasposition: fixed) unless you give it atopvalue other than the default ofauto.A way to fix this is to add
overflow: hiddento#wrapper: http://jsfiddle.net/CyaJ8/6/This works because: