Forum Moderators: open

Message Too Old, No Replies

IE7 does not display colour correctly on images (Table bg imgs)

IE7 does not display colour correctly on images - Structure Tables

         

Xean45

2:58 pm on Feb 22, 2007 (gmt 0)

10+ Year Member



Just a heads-down for people creating or currently using pretty structure tables to display in IE7 (which most everyone should be anyways...Fire Fox ain't that popular yet). In creating a table which looks like a recipe card, I'm using a combination of corner images, set as <table> <td background="image url">, and also <td bgcolor="color"> to fill in the larger areas. In my example, the images are PNGs but the same result occurs with JPG and GIF, which I've tested.

Basically, here's what happens:
The image's BG colour is #6699ff, as is the <td bgcolor="#6699ff">
However, IE7 displays the image's BG colour as #5893FF while the <td bgcolor> remains as #6699ff.

You could change the <td bgcolor> to #5893ff as well, however then it would look odd in all other browsers (since IE7 is the ugly kid out [and yet the most popular...go figure]).

The solution to all this is of course to not use the <td bgcolor> tage, but instead create a 1x1 pixel image that's the desired BG colour (in this case #6699ff) and use that for the table's pure backgrounds instead.

~X8

PS: If any of this is worded oddly, mods: feel free to edit.

tedster

6:25 pm on Feb 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Matching a hex color to an image color was often problematic in the past, too. It might look right on 24-bit color settings but fail on 16-bit, for example. Thank for the heads up on IE7.