What is the easiest way to make a div seem to float on the page so when the page is scrolled up and down the div stays still in relation to the window rather than going up or down?
@KorSep 06.2007 — #Simply adjust the element position (in [B]position:absolute[/B]!) according to the scroll position, on using onscroll event. There are differences between Moz (and compatible), IE in standard mode (and compatible), IE is quirks mode (and compatible) in capturing the scroll position. A simple example on keeping a div on top/left corner of the window onscroll: <i> </i><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <style type="text/css"> html body{ margin:0; padding:0; } #mydiv{ width:200px; height:50px; position:absolute; left:0px; top:0px; background:#ff0000; } </style> <script type="text/javascript"> onscroll=function(){ var obj=document.getElementById('mydiv'), Y; Y=window.pageYOffset?window.pageYOffset:document.documentElement?document.documentElement.scrollTop:document.body.scrollTop; obj.style.top=Y+'px'; } </script> </head> <body> <div id="mydiv"></div> </body> </html>