| <<< Home | << Web | < HTML Notes | Top | Bottom | < Prev | Next > |
|
Topics on this page:
background in the <table> tagIE 3+ and Netscape 4+ support background images in tables. At the time of this writing, Netscape 5 has not been released, and I don't know whether it will behave differently than Netscape 4. When I talk about Netscape here, I mean Netscape 4. IE and Netscape handle background images quite differently from each other. Here's an example of a table with a background attribute in the <table> tag:
<!-- Table to illustrate backgrounds -->
<table border="3" cellpadding="0" cellspacing="0"
background="lily.jpg">
<tr>
<td width="100" height="50"> </td>
<td width="100"> </td>
</tr> <tr>
<td height="50"> </td>
<td> </td>
</tr> <tr>
<td height="50"> </td>
<td> </td>
</tr> <tr>
<td height="50"> </td>
<td> </td>
</tr>
</table>
Here's a couple of screen shots (IE 3 on the left, Netscape 4.5 on the right):
Whoa! What happened here? IE tiled the background throughout the table as a whole. But Netscape placed the background image separately into each cell. If you're contemplating using a background image in a table, you'll want to be aware of this difference. I tried to make Netscape show the tiled image throughout the entire background like IE does by putting the background into a one-cell table, and placing the other table inside of it.
<!-- Table to illustrate backgrounds -->
<table border="3" cellpadding="0" cellspacing="0"
background="lily.jpg">
<tr> <td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100" height="50"> </td>
<td width="100"> </td>
</tr> <tr>
<td height="50"> </td>
<td> </td>
</tr> <tr>
<td height="50"> </td>
<td> </td>
</tr> <tr>
<td height="50"> </td>
<td> </td>
</tr>
</table>
</td> </tr>
</table>
I was very susprised with the result:
It turns out that the inner table "inherits" the background from the outer table,
so the result is the same as if I had specified The following three examples look identical in Netscape and IE - these snapshots are Netscape 4.61. One warning - this only works if the outer table specifies background and NOT bgcolor. If both background and bgcolor are specified, the bgcolor will show up in Netscape while the image will show up in IE.
background in <td> and <tr> tagsI expected bgcolor and background to work like in the <body> tag - background would override bgcolor. But I guess that's too logical. The results depend on the browser. If you include background in the <table> tag but include bgcolor in a <td> tag:
If you want Netscape to show the bgcolor in the cell, you have to add Another difference - IE does not support a background attribute in the <tr> tag. Netscape does support this, and places the background image into each cell of the row. Netscape 4, and IE 3+ support a background attribute in a <td>.
Animated BackgroundsThe background images in a table can be animated gifs. Netscape 4 and IE 4 show the animation. IE 3 won't show the animation, but should show the first frame of the animation. Netscape 3 won't show anything - but that's because it doesn't support background images in tables at all. (I guess you could at least say that it's support of animated gifs is just as good as it's support of non-animated ones!) |
| <<< Home | << Web | < HTML Notes | Top | Bottom | < Prev | Next > |