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 book lover

Growing Rails Applications in Practice

Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.

  • Introduce design conventions for controllers and user-facing models
  • Create a system for growth
  • Build applications to last
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)