Forum Moderators: not2easy

Message Too Old, No Replies

Scaleable Background Images

         

ukgimp

10:24 am on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am sure this has been discussed before but I have a 80% width table/div and it would be cool if I have a background image that scales with the page.

Can CSS do this. I have looked around but to no avail.

Cheers

ukgimp

10:28 am on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Then I find this. Cant be done:

[webmasterworld.com...]

grahamstewart

10:47 am on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You could just stretch a normal img and then overlay your stuff on top of it.

ukgimp

11:12 am on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I am going to have to ask how, as it escapes me. Friday :)

Do you mean

<table>
<tr>
<td><img src="" width="100%" height="20"></td>
</tr>
</table>

or is there a more elegant method?

grahamstewart

11:25 am on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Not really any more elegant but you can just use absolute positioning to place the content over the top of the image.


<img src="image.jpg" width="100%">
<div style="position:absolute;top:0;left:0">
<h1>My content</h1>
<p>
blah blah blah...
</p>
</div>

grahamstewart

11:28 am on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually it might make more sense to do that the other way around and absolutely position the image under the content.


<img src="image.jpg" style="position:absolute;z-index:-1" width="100%">
<div>
<h1>My content</h1>
<p>
blah blah blah...
</p>
</div>

But i'm not sure what browser support for z-index is like.