Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You got bitten by the infamous <a href="http://www.quirksmode.org/bugreports/archives/2006/09/table_border_collapseborder_attribute_bug.html" rel="nofollow"><strong>border-collapse bug</strong></a> (which affects webkit browsers as well, but differs in behavior; the background shifts to the other side). This bug has to do with different implementations in browsers when rounding &frac12; pixels.</p> <p><em>Ben Buchanan</em> wrote about this <a href="http://dev.opera.com/articles/view/33-styling-tables/#bordercollapse" rel="nofollow">on Opera's Web Standards Curriculum</a>, which was later donated to the <a href="http://www.w3.org/community/webed/wiki/Styling_tables" rel="nofollow">W3C web education community group</a>.</p> <p>Here's an extract from the article, for the sake of completeness:</p> <blockquote> <p>&hellip; So what’s the solution? If you want to use a 1px border and a caption background, there really isn’t a fix other than to "live with it ". It is a very minor difference and a non-fatal problem—that is, the table remains entirely usable. So, many people choose to just live with the differences between browsers. Let the Web be the Web. If you are happy to use a larger border, say 2px, then you can simply set a 1px border on table, cells and caption; then set table to separate borders and apply zero spacing between them:</p> <pre class="lang-css prettyprint-override"><code>table { border-collapse: separate; border-spacing: 0; border: 1px solid #000; } th, td, caption { border: 1px solid #000; } </code></pre> <p>In Firefox at least, the 1px borders will add up to the desired 2px rendered border, avoiding the rounding problem on the way. Safari still leaves a gap. Alternatively, you can hide the problem by not using a border or background colour on your caption. The problem is still there; you just won’t see it. This is probably the simplest and most effective solution.</p> </blockquote> <hr> <h3>TL;DR - gimme tha codez!</h3> <p>You have, then, several choices to tackle this pickle:</p> <ul> <li><strong>Lose the border</strong>, and you have no issue. <sup><a href="http://cssdesk.com/S8VBy" rel="nofollow"><strong>(Demo)</strong></a></sup></li> <li><strong>Live with it</strong>, if you must have a background on the header and a 1 pixel border.</li> <li><strong>Use a wider border</strong> (say, 2 pixels) by applying 1 pixel border to cells, headings and captions, set border spacing to 0 and collapse borders by <code>separate</code>. <sup><a href="http://cssdesk.com/Sjcuw" rel="nofollow"><strong>(Demo)</strong></a></sup></li> <li><strong>Don't use background/border colors on the headings</strong> (or captions), effectively hiding the problem away. <sup><a href="http://cssdesk.com/jXnvD" rel="nofollow"><strong>(Demo)</strong></a></sup></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload