GoDxNero Posted June 11, 2009 Share Posted June 11, 2009 I have seen how to change background to always 100% depends on your browser size. But its really annoying because it change all the time when you change the size of your browser . So is there a way for background to always be 100% depends on your sreen resolution setting and not the size of your browser? So if I got a background of 1280x960 and a screen resolution of 800x600 the background image will become 800x600. But since it not depend on browser height and width the "100%" command prolly not work. Can I solve this probleem somehow with javascripts ? Like "get screen resolution setting" and "change image-background to it" ? Link to comment Share on other sites More sharing options...
Ingolme Posted June 11, 2009 Share Posted June 11, 2009 I'm not sure what you're referring to. Do you want the background image to stretch to take the screen width or do you just want it to repeat or are you asking for something else? Link to comment Share on other sites More sharing options...
thescientist Posted June 11, 2009 Share Posted June 11, 2009 i think he wants the background to be based on screen resolution, not browsers size... Link to comment Share on other sites More sharing options...
GoDxNero Posted June 11, 2009 Author Share Posted June 11, 2009 i think he wants the background to be based on screen resolution, not browsers size...Yes you got it right away . 100% based on screen resolution and not on browser size . is it possible ? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 11, 2009 Share Posted June 11, 2009 I don't think it's possible to detect the screen resolution, the best you can do is detect the browser size. Link to comment Share on other sites More sharing options...
GoDxNero Posted June 11, 2009 Author Share Posted June 11, 2009 I have seen those command screen.width on javascripts somewhere . Are they useless ? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 11, 2009 Share Posted June 11, 2009 That's the browser size, not the monitor resolution. Link to comment Share on other sites More sharing options...
Ingolme Posted June 11, 2009 Share Posted June 11, 2009 You can detect the size of the screen with java script: http://w3schools.com/js/tryit.asp?filename..._browsermonitor Link to comment Share on other sites More sharing options...
justsomeguy Posted June 12, 2009 Share Posted June 12, 2009 Ah so Link to comment Share on other sites More sharing options...
GoDxNero Posted June 12, 2009 Author Share Posted June 12, 2009 Is there a known way to change background width or height ? I want to make a function which detects screen resolution and put them in a variable, then use that variable to change the width and height of my background . Is that possible too ? the body background I mean. Well I think this can be solved if I put another big div to wrap the entire page together and put my main background here, then I can change the width and height of the image I guess. But its not so handy ><. Wanna see if change body background width and height possible first : ) Link to comment Share on other sites More sharing options...
justsomeguy Posted June 12, 2009 Share Posted June 12, 2009 You can't scale the background image to match the container that it's in, you need to use a regular image tag instead of a background image. Link to comment Share on other sites More sharing options...
GoDxNero Posted June 12, 2009 Author Share Posted June 12, 2009 But if I put both the contents and the image together in one div it it wont stack >< . Or you mean make div z-index=2 and image z-index=1 ? Link to comment Share on other sites More sharing options...
smerny Posted June 12, 2009 Share Posted June 12, 2009 yes img#bg {position:fixed;top:0;left:0;width:whateverpx;height:whateverpx;z-index:-1;}#content {z-index:1;} <body><img src="blah.jpg" id="bg" /><div id="content">all content</div></body> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.