PDA

View Full Version : Tables and Netscape


JuniorHarris
22-08-2001, 11:41/11:41AM
Let me add one more table tip while I'm at it. This specifically affects Netscape browsers and their display of tables. If you've noticed the problem before you'll know what I'm referring to, otherwise it may be hard to conceptualize.

When coding simple tables with an alternate background color, I always had problems with Netscape displaying the original background color (not table color) between table rows. I tried setting the cellspacing and cellpadding to zero, but for some reason Netscape would still display the document background color between rows. Eventually I discovered to wrap the entire table with another table of the same background to correct the problem:


<!-- Netscape displays native document color between rows -->
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#0000ff">
<tr><td>Table element one</td></tr>
<tr><td>Table element two</td></tr>
</table>

<!-- Extra table wrapper fixes Netscape issue -->
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#0000ff">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" bgcolor="#0000ff">
<tr><td>Table element one</td></tr>
<tr><td>Table element two</td></tr>
</table>
</td></tr></table>

This problem/solution was tested using Netscape 4.75, which I use to view test all code prior to rolling out to production. IE is nice, but it allows simple mistakes to pass which may adversely affect Netscape or other non-IE browsers. Missing an ending table tag in IE may not cause any problems, but for Netscape it can produce disastrous results...and tracking down a missing ending tag can be quite a chore!~ That's why I now use Netscape (in addition to IE) when performing any development work.

I recognize Netscape users are a small percentage of users on the web, but I would venture to say that even 10% of 10,000 is still a value worth recognizing. After all, Netscape users have money too...

markymark
22-08-2001, 12:34/12:34PM
Cheers for that one Junior - I've been wondering how to do that for literally years.

JuniorHarris
22-08-2001, 13:13/01:13PM
Great, that makes it worth the post!~ :)

We had to live with that problem for some time too, since I was somewhat Netscape ignorant when I did our first design. However, when I started our second design, this (and the header/extra line) problem were the first to be addressed!~ ;) There may be other ways around these issues, but those were ones that worked well for us.