Forum Moderators: open

Message Too Old, No Replies

Background Image in Table

Sort of works.

         

Jeigh

5:19 am on Jan 28, 2007 (gmt 0)

10+ Year Member



I sliced a template in Imageready CS2 and coded in XHTML. I also made an external style sheet. Now I'm trying to set some of my images as background images, I have tried a lot of differnt things like using:

"background-image:url(url.gif)"

and none of them worked then I used this:

<td style="background-image:url(images/footer2.gif)" colspan="16">
<img id="footer2" width="780" height="28" />
</td>

That worked perfectly except it still has that little icon thing on it that usually only shows up when the image dosn't work. Does anyone know what I can do?

Thanks :)

<Sorry, no screenhots.
See Forum Charter [webmasterworld.com]>

[edited by: tedster at 5:54 am (utc) on Jan. 28, 2007]

appi2

5:29 am on Jan 28, 2007 (gmt 0)

10+ Year Member



Its because of this line
<img id="footer2" width="780" height="28" />
Thats the image not found icon, your trying to show an image and not giving the source. src="path/to/source"

Try
<td colspan="16" style="background-image:url(images/footer2.gif); width:780px; height:28px;">

</td>

forgot a ; and " doh!

[edited by: appi2 at 5:30 am (utc) on Jan. 28, 2007]

Jeigh

5:30 am on Jan 28, 2007 (gmt 0)

10+ Year Member



Thankyou very much, I'll try it right away :)

It worked! Thanks again :D

[edited by: Jeigh at 5:32 am (utc) on Jan. 28, 2007]

rocknbil

11:42 am on Jan 28, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just a FYI - when you are using external style sheets, the image must be relative to the style sheet, too.

index.html
images/bgimage.jpg
css/mycss.css

background-image:url(/images/bgimage.jpg);

or

background-image:url(../images/bgimage.jpg);

This first allows you to use the same CSS from anywhere and not have to count dots and slashes.