Firefox 1 pixel bug with border-collapse, workaround?

后端 未结 12 2592
误落风尘
误落风尘 2020-12-07 18:59

Is there any workaround for the following \"1 pixel to the left\" bug?

    

        
12条回答
  •  既然无缘
    2020-12-07 19:40

    For those who prefer to keep presentation out of the markup, or who don't have access to the markup, here is a purely CSS solution. Just ran into this problem myself, and tested this solution in FF3.5, IE6, IE7, IE8, Safari 4, Opera 10, and Google Chrome.

    table { border-spacing: 0; *border-collapse: collapse; } 
    

    This sets the table to use border-spacing in all browsers (including the culprit, Firefox). Then it uses the CSS star hack to present the border-collapse rule only to IE, which doesn't properly apply border-spacing (you could also include a separate stylesheet for IE with conditional comments if you don't like hacks).

    If you prefer using cell-spacing, by all means use it. This is simply offered as an alternative method using CSS.

提交回复
热议问题