I wanted to implement a persistent header on my website where the body scrolls if need be. Kinda Like Facebook for example.
I see a lot of examples regarding tables so I wanted to find out if there's a way to do it without tables.
I wanted to implement a persistent header on my website where the body scrolls if need be. Kinda Like Facebook for example.
I see a lot of examples regarding tables so I wanted to find out if there's a way to do it without tables.
You only need to set the position of the header to be fixed like so:
#header{
position:fixed;
top:0; left:0;
height:40px;
width:100%;
z-index:999;
}
This will keep your header fixed to the top of the page and allow you to scroll the page body.
Also, forgot to add, depending on the height of your header, you might want to add a padding from the top, when starting your content. This will ensure that your content is not covered by the overlappng header when the content first loads.
Tables are not necessary at all. You can do it by making a div 100% width, and some arbitrary height, then doing a position: fixed with top and left both set to 0.
Then be sure to push down the other content with CSS so its not underneath that header.