Forums

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

Home Forums CSS Problems with fixed header Reply To: Problems with fixed header

#169170
Alen
Participant

When you set the position of an element to fixed the window (the visible area) essentially becomes its frame. The element is taken out of document flow. Think of it as a soda machine, what happens when you put in $1.35 and press D2, soda pops out and another one slides in its place. Basically same thing happens with the element, so whatever was underneath it now moves up. To get around this you would set the margin on the content that follows your header to the height of the header.

This example might be helpful as well. It shows the difference between fixed and absolute position and further explains the idea of a frame.

Hope that helps,
-Alen