views:

573

answers:

2

I want to move my div down if my window scroll down and move up on window scrolls up? How to implement?

+4  A: 
<div style="position:fixed;">
  <p>Hello World</p>
</div>

position:fixed

Generates an absolutely positioned element, positioned relative to the browser window. The element's position is specified with the "left", "top", "right", and "bottom" properties.

Source: http://www.w3schools.com/Css/pr_class_position.asp

Jonathan Sampson
Note that IE6 does not support position fixed.
Emily
Note also IE6 does not support fun.
Jonathan Sampson
Be aware that there are compatibility issues with position: fixed in "certain" browsers. See here for some work-arounds: http://tagsoup.com/cookbook/css/fixed/
AaronSieb
A: 

You need to use CSS to do this.

<div style="position:fixed">
tj111