Page 1 of 1

CSS Background Image Stretching

Posted: Sun Oct 02, 2011 10:18 pm
by Pazuzu156
Here is what I need help with.

On my website, I have a beasting background image, but I want my image to fill the whole page. Problem solved (not really);

Here is my CSS:

Code: Select all

position:fixed;
	top:0;
	left:0;
	width:100%;
	height:100%;
	z-index:-1;
I have my image stretch the way I want, now I want my image to stay, and not resize when the browser is resized. Any help here would be great.

Re: CSS Background Image Stretching

Posted: Mon Oct 03, 2011 7:17 am
by Celauran
If you want it a specific size, give it fixed values for height and width, not percentage values.

Re: CSS Background Image Stretching

Posted: Mon Oct 03, 2011 3:36 pm
by Pazuzu156
I know that, but I want it to be determined by the size of their screen, how would i do that in JS?

Re: CSS Background Image Stretching

Posted: Mon Oct 03, 2011 3:43 pm
by Celauran
window.innerWidth and window.innerHeight

Re: CSS Background Image Stretching

Posted: Mon Oct 03, 2011 3:45 pm
by Pazuzu156
Thank you

Re: CSS Background Image Stretching

Posted: Mon Oct 03, 2011 3:47 pm
by Celauran
My bad, I misunderstood you. That's for the size of their browser's viewport. You want screen.width and screen.height.

Re: CSS Background Image Stretching

Posted: Mon Oct 03, 2011 3:50 pm
by Pazuzu156
Yeah, thats what i meant to say, but thank you for the help.