Background images and colors in tables under Netscape

Sponsored Links

Here is what you want to do... you make a table with a background image and put background color in some of the table cells. All this looks good in Internet Explorer, but the moment you check it in Netscape, you get a rude shock. Netscape blatantly ignores the bgcolor attribute of <td>, overriding it with the background (image) of <table>.

You check and recheck the HTML code but nothing seems to be wrong with it.

Here is how the table would look... (the table has a picture of Freddie Mercury as its background). Note: Internet Explorer users might not know the difference since the two tables below are rendered in the same manner. Hence, it is recommended that you view this page in Netscape.

CELL 1
CELL 2
CELL 3
CELL 4
CELL 5

Here is a simple solution to your problem.
Put a background attribute in each <td> where a background color is desired and supply it with a URL of a 1X1 pixel transparent .gif image. The code for <td> which works both in Netscape and I.E. is:

<td bgcolor="#color_you_desire" background="blank.gif">
Cell Contents</td>

The bgcolor attribute can take either hexadecimal color code or color name. Download the blank.gif from here.

Corrected table display in Netscape.

CELL 1
CELL 2
CELL 3
CELL 4
CELL 5

Further, to prevent tiling of the background image, place this table inside an outer 1 cell table. (Refer the previous tip for further details)

CELL 1
CELL 2
CELL 3
CELL 4
CELL 5


Click this button if you liked the article!

Page contents: HTML Tip: Getting Netscape to display correctly a table cell background or color on a web page.

AddThis Social Bookmark Button


Vote and Share