How would I go about keeping my header from scrolling with the rest of the page? I thought about utilizing frame-sets and iframes, just wondering if there is a easier and more user friendly way, what would be the best-practice for doing this?
How would I go about keeping my header from scrolling with the rest of
Share
Note: This answer dates from 2010. Consider
position: stickyin 2021, as mentioned in another answer.Use
position: fixedon thedivthat contains your header, with something likeIn this example, when
#contentstarts off 100px below#header, but as the user scrolls,#headerstays in place. Of course it goes without saying that you’ll want to make sure#headerhas a background so that its content will actually be visible when the twodivs overlap. Have a look at thepositionproperty here: http://reference.sitepoint.com/css/position