Xaisoft Xaisoft - 2 months ago 8
CSS Question

Tables in IE do not have border when border = 0 in a css reset?

In my css file, I have a reset where I am setting the border:0. This causes all tables in IE, not firefox to have no border. Even if I set the border inline on the table, it still does not show in IE. Does anyone know the solution to this?

Part of the rest:

table, img
{
border:0;
}

<table border="1">
<tr>
<td></td>
</tr>
</table>


Border shows up in firefox, but not in IE. Do I have to do style="border:1px solid black" in the table instead of border="1"

Answer

If you want that specific table to have a border, I would just give it a class:

table, img
{
   border:0;
}
table.something
{
    border: solid 1px #000000;
}

<table class="something">
  <tr>
    <td></td>
  </tr>
</table>

That should work in all browsers.

Comments