Reputation: 2192
I would like to fix my background to 100% height of body and leave it there even when rest of the page scrolls.
How do I achieve this?
Right now all I have is background:url(bg.png);
. The height of the image is 1200px and width 20px, if that matters.
Upvotes: 1
Views: 316
Reputation: 522
Some browsers still have trouble supporting the stretching of background images so here's a workaround.
Since it's already 1200px, you can use background-attachment:fixed;
on the background to make it follow when they scroll. Example at w3schools. You can make the image look like it is meant to flow into a solid color at the bottom with a nice gradient, etc.
Upvotes: 0
Reputation: 1497
Depending on what you want the background image to do there are a couple of options. There is a great article on ALA about full screen BG images that accounts for scaling:
http://www.alistapart.com/articles/supersize-that-background-please/
If you are just looking to position the image in the browser you would do:
background:url(bg.png) no-repeat top left;
background-attachment:fixed;
Or however you want to position it respectively (top right, etc.)
Upvotes: 3