Content appearing behind fixed header

adeniyi makinde picture adeniyi makinde · Jun 20, 2012 · Viewed 13.2k times · Source

I fixed the header section of a website, but the first div of the page appears behind the header; instead of starting from the end of the header.

Answer

Zoltan Toth picture Zoltan Toth · Jun 21, 2012

When you apply position: fixed or position: absolute the element is being removed from the document flow, so the elements that come after treat it as a non-existent. That's why your div jumps up. To fix that apply a margin-top that equals to your header height - http://jsfiddle.net/2xjES/