Hi, I’m still quite a beginner in css. I’m trying to re-design my pages with css and so far so good, but now I get to the point where I’m adding content and the content appears to move the containing div downwards for some reason and I don’t know what is doing it. Here is what I have.
It looks like you have collapsing margins, it is something that everyone new to CSS struggles with.
You need to force the #banner div to un-collapse all child margins. You could set margin:0; on the h1 but that is not productive since there are times when you actually do want a top margin. It’s best just to fix it at the source of the problem which is the parent allowing it’s child margins to collapse.
What happens is that the parent (banner) collapses it’s background and it makes it appear to have shifted down.
To fix it you can set a 1px top padding on it or go into overflow mode (which is what I usually do). Unless you know what the relative positioning is doing on banner let’s remove it for now also.