quick css q
- Started
- Last post
- 9 Responses
- johndiggity
trying to position a div with a bg image so it stays in the bottom right corner of the browser window, regardless of scrolling or window resizing.
right now i have:
position:absolute; bottom:0px; right:0px;when i resize the window or scroll, the image does not stay anchored in the corner. what i am not doing?
- johndiggity0
sorry, the image stays in the corner when window is resized, but scrolls when the page scrolls. i don't want this.
- jonatne0
background-attachment: fixed;
- johndiggity0
does not appear to be working. i have a background image on the page already that is fixed. i am trying to have the div in question sit in the bottom right corner of the page on top of the background image, but below the content.
- bort0
position:fixed on the div in question.
- johndiggity0
cheers bort!
- jonatne0
read the question wrong
- hilchev0
you can't do this so simply. IE6 for instance does not support fixed positioning of the bgr. Anyway, if you position something absolute like you said, when you resize the windows to a smaller resolution, and then use the Vscroll, your positioned element will stay. That's because when you load the page, the css finds the current bottom and right 0'os.
The solution is to use some simple java script or a jquery component if you find a good one.
- Juddly0
html, body {width:100%; height:100%; overflow:hidden;}
#wrapper {position:absolute; width:100%; height:100%; overflow:auto;}
Put content that needs to scroll inside the wrapper and anything you want to stay fixed outside the wrapper. (with position:fixed; and bottom / top / whatever).
This works in IE6 without any JS.
- Stugoo0
I fucking love css