...

View Full Version : Background image stretch



Incarcerated15
12-13-2002, 11:01 PM
ok so here's the deal, i have an image (300 x 10) that i want to have as the background image but i want it to fit the width of the screen and repeat down

jokerfmj
12-13-2002, 11:12 PM
So you're looking to be able to stretch it width wise but not height wise?

Incarcerated15
12-13-2002, 11:21 PM
yes, it's a simple pattern so it can repeat down, but looks bad if it's stretched down

jokerfmj
12-13-2002, 11:24 PM
I'm not sure if you can only stretch an image one way...

Maybe open it in photoshop and resize it to fit width wise, then just tile it on your site?

Incarcerated15
12-14-2002, 12:27 AM
well i want the image to be able to adjust to different sizes, i tried making just an image and stretched it across and repeated it - just to see how it looked, and it works out fine, but i don't know what to do for background

chrismiceli
12-14-2002, 01:25 AM
try this
<img src="whatever" height="yourheight" width="yourwidth" name="img0">
<script type="text/javascript">
document.body.background = document.images['img0']
</script>
it might not work because it is looking for the source attribute of the image, but you could at least try.

Incarcerated15
12-14-2002, 06:04 AM
but i don't want to set the size, i want it to fit to the width and repeat like a normal image for the height

[m]
12-14-2002, 07:49 AM
as far as I know there is no way to streach the bg image to fit only one side..I may be wrong cuz I'm no expert

Incarcerated15
12-14-2002, 05:48 PM
that made the image repeat properly down the right side of the screen, but not stretch

zoobie
12-15-2002, 02:42 AM
There is no stretching in css. They've wanted to add background-stretch and background-size=100% for quite some time but haven't. Background-position is just that. This can only be done with javascript. :D

Incarcerated15
12-15-2002, 06:30 PM
ok i'll go next door to ask the java script forum



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum