Forum Moderators: open

Message Too Old, No Replies

Tiling and Stretching a background image

         

wfernley

9:53 pm on Dec 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey everyone. I'm working on a site, and I can't remember the code to insert to make the background of a table not tile and strech the image. Basically I have a table, and in the middle column I have an image that is 10px high and has a width of 1. The column is 100 px high, so the image in the background tiles 10 times. I was curious if someone can give me the code to make it not tile (I actually have the code in the CSS file to fix this) but I need the image to stretch the whole 100px. Can anyone tell me how I can get it to stretch?

Thanks :)

Wes

garann

6:00 pm on Dec 10, 2003 (gmt 0)

10+ Year Member



I don't think there's any way to get a background image to stretch. What you could do is place an image behind your table, using absolute positioning in your CSS, and make the height 100px. Your table would have to have a transparent background.

hth,
g.

tedster

5:02 am on Dec 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right information there, garann -- the way to stretch the background image is to actually stretch it in a graphics program first, and save it at the dimensions you want.

The css for not tiling at all is background-repeat:no-repeat; Other options are

background-repeat:repeat-x;
background-repeat:repeat-y;
background-repeat:repeat; (this is the default behavior)