PDA

Click to See Complete Forum and Search --> : Doesn't move when page is scrolled


PunkRockNeil
Jan 17th, 2003, 12:14 PM
Hi,

Alright, I want to place something at the top of a page and when the user scrolls down the page this stays at the top. A header of sort. Now, the thing is I don't want to use frames because I'd like to keep the entire form together to keep things less difficult...

How would I do this?

Thanks,

Neil

Rick Bull
Jan 17th, 2003, 02:04 PM
The easy (and standard) way to do it is like so:

CSS:

#ID {
position: fixed;
top: 0px
left: 0px;
}


HTML:

<div id="ID">This should be at the top</div>


But unfortunately IE (for Win at least) doens't support fixed positioning, so you'll have to use a javascript for that. Or alternatively if you just want it absolutely positioned you could do this:


#ID { position: fixed; }
html>body #ID { position: absolute; }
#ID {
top: 0px
left: 0px;
}