Border of single th spreads to neighboring th when colspan set on td row below

Posted by Samuel Hapak on Stack Overflow See other posts from Stack Overflow or by Samuel Hapak
Published on 2012-09-16T15:27:35Z Indexed on 2012/09/20 9:38 UTC
Read the original article Hit count: 228

Filed under:
|
|
|

Having following html code:

<table>
<tr><th>First</th><th class='second'>Second</th><th class='third'>Third</th><th>Fourth</th></tr>
<tr><td>Mike</td><td colspan=2 >John</td><td>Paul</td></tr>
</table>?

And following css:

table {
    border-collapse: collapse;
}

td, th {
border: 1px black solid;
}

td {
    border-top: none;
}
th {
    border-bottom: none;
}
th.second {
    border-bottom: 3px green solid;
}
th.third {
}

? I would expect as result one table with 3px solid green line below the second th cell. Instead of that in Chrome, I have solid green border below both the second and the third th cell.

In the firefox, results are just as expected. Is this browser bug, or my code is illegal?

You can see example at http://jsfiddle.net/tt6aP/3/

PS: Try to set

th.third {
    border-bottom: 2px solid red;
}

And then try to raise it to 3px. This is even more strange.

Screenshots

Expected: Table as seen in firefox

Chrome: Table as seen in chrome

Firefox: Table as seen in firefox

© Stack Overflow or respective owner

Related posts about css

Related posts about google-chrome