CSS: Fixed background images taller than the browser viewport
Posted
by jj_aa
on Stack Overflow
See other posts from Stack Overflow
or by jj_aa
Published on 2009-08-06T15:21:10Z
Indexed on
2010/04/13
12:02 UTC
Read the original article
Hit count: 123
I've got a large photo (940x1210) as the background image for a #page div which wraps around all the content on a site. Since the photo is a headshot, it looks pretty silly tiled, so I've set it not to repeat, and positioned it at 0,0.
When the content enclosed by #page is taller than 1210px and the background image is set to scroll, the photo scrolls out of view, but if it's fixed, only the part of the image displayed initially in the browser viewport shows up- either the top half (fixed top left) or bottom half (fixed bottom left).
Here's the question: how can I fix the background image to the bottom of #page (or the body) while scrolling through the full height of the image until I get to the bottom?
© Stack Overflow or respective owner