views:

499

answers:

1

I created a html table and used this css to style the border as i wanted:

  1. the top row and column to be one color and the rest of the table to be stripes alternative row colors

  2. regular single black border over each cell

Here is my css:

#functionMatrixTable td
{
 border-collapse: collapse;
 border-width:1px;
 border-color: Black;
 border-style: solid;

}

#functionMatrixTable th
{
border-collapse: collapse;
border-width:1px;
border-color: Black;
border-style: solid;
}

 #functionMatrixTable tbody tr.odd th, tbody tr.even th {
   background-color:#D8D8D8  ;
}


 #functionMatrixTable tr.odd td{
background-color: #ffffff;
padding:4px;
 }

  #functionMatrixTable tr.even td {
background-color: #CDE0F6;
  padding:4px;
 }

#functionMatrixTable th
{
    padding:4px;
    background-color:#D8D8D8  ;
    color:#787878 ;
}

The strange issue in Firefox is that it seems to put a border around half of my table but not the rest. Here is an example image. It looks fine in IE8. any ideas what i am doing wrong here?

Screenshot of my html table in firefox. when i click in a cell the border appears??

alt text

+1  A: 

I think you have a bug somewhere in the code that generates your HTML, based on that screen-shot, I would say that your table HTML is malformed. Also, the sample CSS you provided seems incomplete.

I just tried the following sample (with some CSS modifications), and it rendered a table correctly in firefox with borders around all the elements (sorry, I can't test this in IE):

<html>
<head>
<style type="text/css">

#functionMatrixTable
{
  border-collapse:collapse;
  border-width:1px;
  border-color: Black;
  border-style: solid;
}

#functionMatrixTable td, th
{
  border-collapse:collapse;
  border-width:1px;
  border-color: Black;
  border-style: solid;
}

#functionMatrixTable tr.odd td{
  background-color: #ffffff;
  padding:4px;
}

#functionMatrixTable tr.even td {
  background-color: #CDE0F6;
  padding:4px;
}

#functionMatrixTable th
{
  padding:4px;
  background-color:#D8D8D8  ;
  color:#787878 ;
}
</style>
</head>
<body>
<table id="functionMatrixTable">
<tr>
<th>AAA</th>
<th>BBB</th>
</tr>
<tr class="odd">
<td>A</td>
<td>B</td>
</tr>
<tr class="even">
<td>C</td>
<td>D</td>
</tr>
<tr class="odd">
<td>A</td>
<td>B</td>
</tr>
<tr class="even">
<td>C</td>
<td>D</td>
</tr>
<tr class="odd">
<td>A</td>
<td>B</td>
</tr>
<tr class="even">
<td>C</td>
<td>D</td>
</tr>
</table>
</body>
</html>

If your table is static HTML, then something like the above should render in Firefox with no problems. If you're rendering the table on the fly, then the method you're using is most likely not compatible with Firefox. Are you using javascript maybe?

Mike Mytkowski
yup . . i had <thead> instead of </thead>
ooo
It happens. :)Glad you found it.
Mike Mytkowski
its amazing what one bad character can do to an application :)
ooo