stretching a background image in HTML
stretching a background image in HTML
Out of context: Reply #18
- Started
- Last post
- 19 Responses
- thatboyneave0
You can't resize a background image directly (correct me if I'm wrong). It has to be an <img /> tag.
But, if you want to keep your markup clean it's possible to define the bg image in CSS, and stretch it with jQuery:
1. use css() to find out the url of the background image
2. create an image element with the same source as the background image
3. remove the background image
4. make function that stretches the image to fit the window whenever the window is resizedHere it is in effect: http://www.alexandraowen.co.nz/