The problem I face is IE 11 seem to have inconsistent <td>
inner height across single <tr>
while other browsers keep it the same.
Here's a pen illustrating my problem: http://codepen.io/anon/pen/emKEBZ
In my layout I have an absolutely positioned pseudo-element (green border) which I want to display on a (outside) <td>
. I'd like it to be always as high as the whole <tr>
it is in. The content of <td>
s is dynamic - I have no control over it's size (like I do in the pen).
I gave it height: 100%
, assuming that every <td>
in a row has the same height.
td {
position: relative;
}
td:before {
content: "";
display: block;
position: absolute;
top: 0;
left: -5px;
width: 3px;
height: 100%;
background-color: green;
}
And yeah, that height calculates to the same value across all of the cells in the same row in Firefox and Chrome:
but to different height for each cell in IE 11:
The problem seems to be that in height: 100%
IE refers to the inner height (the one inside the padding) of the containing <td>
, while other browsers take total height (height + padding + border). And even then, the inner height of all <td>
s along one <tr>
is identical in Firefox, while it isn't in IE. Is any of those approaches wrong? Is there a way to force IE to work like other browsers do?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…