views:

45

answers:

2

how to stretch the background images using CSS for page backgrounds and for DIV & table backgrounds... so that if the window size changes the background image size should stretch (expand / contract) accordingly....

+1  A: 

Only can be done in CSS3 with background-size. You can also use -o-background-size, -webkit-background-size, and -moz-background-size to try and maximize browser support. You should set the value to be 100%. In other browsers you can repeat the background or use a color once you're out of image, but not stretch. There are suggestions in the first link below to try and fake it.

See:

Adam
A: 

Try this:

http://www.htmlite.com/faq022.php

Here's another:

http://www.cre8ivecommando.com/css-background-image-stretch-1786/

tahdhaze09
i am looking for purely setting the background to fit the screen\container... if i have 10 DIVs on one page then it means with the given method it means that i am going to put 20 DIVs to have backgrounds fit the screen\container... no man that's not a solution...
Junaid Saeed
Aren't you looking for a full background image solution for your page? There's two solutions that don't even require js. The second link even gives you an example. Try it; when you stretch the window, the background image expands and contracts with it.
tahdhaze09
Junaid Saeed
OK, the second part sounds a little tricky. When you change the dimensions of the viewport the divs and tables also stretch as well, at the same time. Be right back...
tahdhaze09