Reputation: 1857
I'm using this CSS to postion a div horizontally and vertically to the window which works fine until you scroll down the page, then the div remains in the same centred position as if the page hadn't been scrolled.
width:600px;
height:300px;
position:absolute;
left:50%;
top:50%;
margin:-150px 0 0 -300px;
z-index:99;
Can this be done using CSS?
Upvotes: 0
Views: 186
Reputation: 14983
Take a look at:
http://www.w3schools.com/cssref/playit.asp?filename=playcss_position&preval=fixed
position: fixed;
might be what you're looking for.
Upvotes: 0
Reputation: 16210
That's because your position
is absolute
!
You should try using position: fixed;
instead.
Upvotes: 2