Margin-Top push outer div down

Danny picture Danny · Apr 21, 2010 · Viewed 76.9k times · Source

I have a header div as the first element in my wrapper div, but when I add a top margin to a h1 inside the header div it pushes the entire header div down. I realize this happens whenever I apply a top margin to the first visible element on a page.

Here is a sample code snippet. Thanks!

Answer

JuanPablo picture JuanPablo · May 23, 2010

put overflow:auto in the parent div
see more in this link