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

Home Forums CSS Main wrapper sits behind fixed header. Re: Main wrapper sits behind fixed header.


What you need is a top margin on the main wrapper equal to the height of the header wrapper. The problem is that this margin will extend outside of the main container. There are a couple of ways to prevent that. One is to add overflow: hidden to #container which changes its block formatting context and the children’s margin will be contained within the parent. Another option is to use a top padding or top border on the #container – either of which will again cause the children’s margin to be contained within the parent (rather than extending beyond, which is correct default behavior).