Forum Moderators: open

Message Too Old, No Replies

table background/img in IE

         

Readie

1:21 am on Dec 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There's something I've noticed (and it only seems to happen in Internet Explorer)

If I have a table background defined as an image in PNG format, which is simply a 1x1 pixel, and it's colour #c0c0c0 (I assume it happens with other colours, this is just one colour I know for sure it happens with) and I then put that same image in an image tag inside the table, so we'd have

..snip..
<td background="bg.png">
<img src="bg.png" height="100" width="100">
</td>
..snip..

then the table background appears to be a different colour to the image.

I'm curious as to whether there is a solution to this other than simply changing to a web-safe colour like #cccccc?

Regards,

Readie

birdbrain

1:32 pm on Dec 22, 2009 (gmt 0)



Hi there Readie,

I was unable to recreate your observed effect in either IE6 or IE8.

However what I did notice was that the bg.png color was
rendered as #b9b9b9 in IE and as #bfbfbf in Safari.

Opera and Firefox both rendered the color as #c0c0c0.

Also note that the background attribute is deprecated.

You should use CSS instead.

birdbrain

Readie

4:17 pm on Dec 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I do use CSS :) I was just phrasing it that way for the example.

I have seen the effect in both IE7 and IE8, but you say you can't get the effect, so there must be some other underlying reason, although I did find that the background was being rendered as #b9b9b9 when I was inspecting it myself.

So it seems the only true solution is to use another colour.

Thankyou for spending the time to investigate Birdbrain :)

Regards,

Readie

birdbrain

4:51 pm on Dec 22, 2009 (gmt 0)



Hi there Readie,

I tried the same experiment using #f00 instead of #c0c0c0 and both IE and Safari rendered the colour correctly.

Perhaps you should go with your suggestion of "Web Safe Colors". ;)

birdbrain