The problem I face is IE 11 seem to have inconsistent I finally managed to do that. Here is the code, hope it helps. Fiddle here. Strange and interesting behavior by IE about table-cell here.
If you want an approach, you should put the cell on inline-block and set the height value, then align the content using line-height also reset the line-height for the text container like: Try on IE, I hope this will help you: http://codepen.io/pik_at/pen/WbyZrG I will just add inner height across single while other browsers keep it the sa
var spans = document.querySelectorAll( "span.bar" ),
count = spans.length;
while ( count-- ) {
spans[count].style.height = spans[count].parentElement.offsetHeight + "px";
}
body {
padding:15px;
}
table {
border: 1px solid black;
border-spacing: 10px;
cell-spacing: 0;
}
tr {
border: 1px solid red;
}
td {
vertical-align:center;
position:relative;
box-sizing: border-box;
position: relative;
border: 1px solid black;
}
td .bar:first-child,
td .bar:last-child {
display: block;
background: green;
width: 3px;
left: -5px;
height: 100%;
position: absolute; top: 0;
z-index: 1;
}
p {
margin: 0;
background-color: #dedede;
padding: 0px;
}
.tall {
height: 100px;
}
.medium {
height: 60px;
}
.short {
height: 30px;
}
<table cellspacing="1" cellpadding "0" border="0">
<tr>
<td>
<span class="bar"></span><p class="tall">Save me!</p><span class="bar"></span>
</td>
<td>
<span class="bar"></span><p class="medium">From problems</p><span class="bar"></span>
</td>
<td>
<span class="bar"></span><p class="short">With IE</p><span class="bar"></span>
</td>
</tr>
</table>
td {
display: inline-block;
height: 137px;
position: relative;
line-height: 137px;
}
p {
display: inline-block;
vertical-align: middle;
background-color: #dedede;
line-height: 1;
}
margin
to total 100
.tall {
height: 100px;
}
.medium {
height: 60px;
margin: 20px 0;
}
.short {
height: 30px;
margin: 35px 0;
}