I have an HTML table with collapsed and adjacent borders and a standard border on all cells and I want to change the border color of a specific row to something else. The problem is that when the borders are collapsed and neighboring cells have different colors (or styles in general I assume) the browser does not render in a visually acceptable manner.
Here’s my HTML:
<table>
<tr><td>Lorem</td><td>Ipsum</td></tr>
<tr><td>Lorem</td><td>Ipsum</td></tr>
<tr id="foo"><td>The border of these cells</td>
<td>is not uniformly red!</td></tr>
<tr><td>Lorem</td><td>Ipsum</td></tr>
</table>
The CSS:
table { border-collapse: collapse; border-spacing: 0 }
td { padding: 5px; border: 3px black solid; }
#foo td { border: 3px red solid; }
There is also a JSFiddle of the above.
How different browsers render it:
IE 7 (standards):

IE 8 and 9 (standards):

Firefox 11 (note the subtle visual artifact on the left red border and the quirky way it chooses to render the corners):

Chrome 18:

The question: What can I do to get a visually acceptable render? Can that render be the ideal of “red borders always take precedence over black ones”?
Clarification:
I am first and foremost looking for a pure CSS solution.
If this is not possible, I would work with something that requires small and localized modifications (i.e. not something I ‘d have to do on every table everywhere).
Javascript is acceptable, since in the actual website the styles that control the borders are applied dynamically based on user interaction. The event handlers are set up by code almost identical to this.
I came to this solution without extra-markup : http://jsfiddle.net/fcalderan/PAJzK/12/
the idea is to avoid using
border-collapseand using bordertop/rightfor table cells and borderbottom-leftfor table element.tried with IE8, FX11 and CH17, here’s the relevant CSS
here an issue occurs if the highlighted row is the last one: in that case
#foo + tr tdwouldn’t match anything : in that case you could write instead this rulesee example in http://jsfiddle.net/fcalderan/PAJzK/14/