CSS box-shadow not working in IE9 inside tables with collapsing borders

Updated . Posted . Visible to the public. Deprecated.

Microsoft does not support IE9 anymore, and neither do we.

Though Internet Explorer 9 supports the box-shadow CSS property there is a nasty bug which sometimes prevents it from rendering the shadow properly.

Consider this HTML:

<table style="border-collapse: collapse">
  <tr>
    <td>
      <div style="box-shadow: 0 0 10px #f00">Hello universe</div>
    </td>
  </tr>
</table>

While it works in other browsers, IE9 is not showing any shadow. For some reason, it requires border-collapse: separate for the table to be set:

<table style="border-collapse: separate" cellspacing="0">
...

Although this does the trick, you need to set a zero cellspacing in the HTML (or border-spacing in CSS, if possible) to avoid space between table cells.\
If you previously gave borders to your th and td elements, those will no longer overlap. One solution is to only use borders on the bottom and right sides.

Or, you could just avoid using tables and save yourself some IE trouble.

Arne Hartherz
Last edit
Henning Koch
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2012-01-05 10:53)