The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Cannnot make top margin work on this div Re: Cannnot make top margin work on this div


That’s not quite right Senff. The ‘problem’ is that both the #content and #sidebar are floating are taken out of the document flow. The nearest in flow element that #testimonial’s margin can ‘push’ off of is #grid’s top edge (because it has overflow: hidden; changing its block formatting context, otherwise it would be #header). If you were to give #testimonial a top margin larger than either float (starting around 520px depending on font size) you would see it start to move down.

So, the in flow elements can’t push off of a float, however a float can push other elements with their margins. So the easiest fix is to put a bottom margin on the two floats (use both in case one is longer than the other) equal to the spacing you wanted with the top margin on #testimonial.