IE Table Border Bug?

I encountered this the other day. Firefox, Safari and Opera do what I expected and believe to be correct. I’m curious if anyone can explain this, or knows of a workaround that “doesn’t suck”. Take the following testcase:

  1. < !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
  2. <HTML lang="en">
  3.  <head>
  4.         <title>IE Table Border Bug</title>
  5.         <meta HTTP-equiv="Content-Type" content="text/html; charset=UTF-8">
  6.         <style type="text/css">
  7.                 table {
  8.                         background-color: green;
  9.                         border-collapse: collapse;
  10.                         border-spacing: 0px;
  11.                 }
  12.                 table td {
  13.                         width: 100px;
  14.                         border-bottom: 3px solid red;
  15.                 }
  16.                 table td.strip {
  17.                         background-color: #fff;
  18.                         border-bottom: 3px solid #fff;
  19.                 }
  20.         </style>
  21. </meta></head>
  22. <body>
  23. <table>
  24.            <tr>
  25.                    <td> Test</td>
  26.                    <td class="strip"> Test</td>
  27.                    <td> Test</td>
  28.            </tr>
  29.  
  30. </table>
  31. </body>
  32. </html>

Example

Pay attention to the bottom border. Should be flush with the green cells.

Firefox 2.0

Firefox Render

Close Up:
Firefox Render (Close Up)

IE 6

IE Render

Close Up:
IE Render (Close Up)

IE 7

IE7 Render

Close Up:
IE7 Render (Close Up)

Strange, but interesting. Excuse the poor quality of the screenshots. I cut these up really quick. Perhaps this weekend I’ll do a nicer job.

Tags: , , ,



9 Responses to “IE Table Border Bug?”

  1. Dao Says:

    td { position: relative; }

  2. Gary van der Merwe Says:

    Here is a work around (kind of sucks.)
    http://garyvdm.googlepages.com.....derBug.htm

    It seems like when border-collapse is collapse, the background is rendered under the right and bottom border, and the default border is 1px transparent.

    My workaround is to set the offending borders to the color of the next sibling cell.

  3. Philippe Says:

    remove the border-collapse:collapse.
    use the cellspacing=”0″ attribute on the table (yes perfectly valid)

    border-collapse never works correctly on iExploder.
    http://dev.l-c-n.com/iExploder7/table-robert.html

  4. Neil Says:

    You can also work around the problem by turning off border-collapse (but I couldn’t persuade IE6 to turn off its cell padding except by using HTML).

  5. Robert Says:

    Philippe: I think that’s the best fix… Kinda stinks you have to do that.

  6. Joe Says:

    the CSS td line that Dao put works. and simpler too.

  7. John taylor Says:

    i agree, the CSS that Dao put works just dandy for me too.
    I just did a find and replace for

  8. Cam Says:

    I want to get rid of “border-collapse: collapse;” but can not get it done. I am using IE6.

    table.coll
    {

    border-spacing:0px;
    border-width: 0px;
    cellpadding: 0px;
    cellspacing: 0px;
    }
    table.sep
    {
    border-collapse: collapse;
    }

    Peter
    Griffin

    Lois
    Griffin

    Peter
    Griffin

    Lois
    Griffin

  9. Cam Says:

    http://www.w3schools.com/css/t.....r-collapse

    I copy code from upper link.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.