Read more

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

Arne Hartherz
January 05, 2012Software engineer at makandra GmbH

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.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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.

Posted by Arne Hartherz to makandra dev (2012-01-05 11:53)