Page 1 of 1
How do i stretch my background image 100%
Posted: Sun Jun 13, 2010 10:28 am
by adsegzy
Hello Friends,
I need to use an image as a background, but i dont want it to repeat horizontal or vertical. i want it to stretch 100% horizontal, pls how do i do this?
regards
Re: How do i stretch my background image 100%
Posted: Sun Jun 13, 2010 10:47 am
by PHPHorizons
Hello adsegzy,
I'm assuming you're looking for a css related answer here (
Board index » Design » HTML, CSS and other UI Design Technologies).
There are proprietary background stretch css rules but they are not standardized across the main/popular browsers. Therefore, you cannot stretch background css images in a cross browser way at this time.
You could just put in an HTML IMG Element and apply a % width/height to it. But you would have to position your content on top of that image, and is not a natural way to do a website, at all...
You could host multiple bg images of different sizes. Then you can use javascript to detect the users screen width, and set the bg image to suit.
The best option though, and I know no one likes to be told not to do the thing they want to do, is to change your design so that you can avoid the need for a stretched background image since browsers just are not designed to cope with such a thing very well at all at this time.
Cheers