Reputation: 28969
When adding box-shadow
to a <tr>
, Firefox and Chrome both show it around the entire row, while Edge directly applies it to each <td>
which ends up looking like grid rather than a continuous row.
Here is a demo of the behaviour:
table tr {
box-shadow: 0 0 0 1px red inset;
}
<table>
<tr>
<td>hello</td>
<td>world</td>
</tr>
</table>
And here are screenshots:
So it seems like Edge is directly applying the given style to the <td>
elements under the <tr>
as if I've set the following:
table td {
box-shadow: 0 0 0 1px red inset;
}
<table>
<tr>
<td>hello</td>
<td>world</td>
</tr>
</table>
By experimenting, it also seems like display: block
appears to fix this and it makes all browsers display the shadow (almost) equally
table tr {
box-shadow: 0 0 0 1px red inset;
display: block;
}
<table>
<tr>
<td>hello</td>
<td>world</td>
</tr>
</table>
display: block
looks in Firefoxdisplay: block
looks in Chromedisplay: block
looks in EdgeEdge does display the box-shadow
on the <tr>
and Firefox and Chrome have a similar white-space on the left and right.
According to the box-shadow
draft specifications it's supposed to be applicable to all elements. I am interested in why Edge does what it does: why does it skip the <tr>
and apply the CSS directly to <td>
elements? It seems completely unintuitive - other properties like border
don't behave this way - if you apply that to a parent, the children don't all get border
, too.
Upvotes: 2
Views: 190
Reputation: 690
Limited CSS properties applying to <tr>
elements (and other elements with "display:table-row") has been the way things are since CSS first became available. More CSS3 properties are listed in the specs as applying to "all elements," but apparently Edge is making that apply to the cells instead of the row itself.
Upvotes: 2