brem13 Posted April 13, 2009 Share Posted April 13, 2009 hey im trying to make my site have a background picture on my site have a fixed position and have it stretch to the size of the window. it makes the picture the background and stretches it to the size of the screen, but all the content that should be on it is underneath the picture (screenie below) here is the code in my style.css #bg_image { width: 100%; height: 100%; left: 0px; top: 0px; position: absolute; z-index: 0; } #contents { position:absolute; z-index:1; } here is the code after my body tag echo "<div id=bg_image><img style='width: 100%; height: 100%;' src=\"$background\"></div><div id=contents>"; and before the end body tag echo "</div>"; any help? [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
mimintweak Posted April 14, 2009 Share Posted April 14, 2009 Hi, Try this. body { background: url(../images/your image.jpg) repeat x-y; } #contents { position:absolute; z-index:1; } Quote Link to comment Share on other sites More sharing options...
jcombs_31 Posted April 14, 2009 Share Posted April 14, 2009 Please note that you can't actually stretch the background, you can only tile it. You are currently using the <img> tag rather than setting the background. Quote Link to comment Share on other sites More sharing options...
noober Posted April 15, 2009 Share Posted April 15, 2009 By the way, having a picture stretch to the size of the window is impractical in more ways than I'd prefer to explain. The most important aspect to consider is pixelation. Tiling a background is good depending on design. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.