【发布时间】:2018-12-17 11:32:05
【问题描述】:
我已经使用 position: absolute 和 left 值在 TD 元素内定位了一些 div 元素,但我需要在中间垂直对齐 div 没有固定边距和填充值,因为我的TD高度可以是任何东西。我添加了示例供参考,有帮助吗?
.content {
position: absolute;
left: 20px;
background: grey;
width: 100px;
height: 20px;
}
td {
border: 1px solid grey;
border-collapse: collapse;
/* Works in chrome, Firefox, Edge but not in IE 11*/
display: flex;
align-items: center;
}
.content2 {
position: absolute;
left: 140px;
background: grey;
width: 100px;
height: 20px;
}
<table>
<tr>
<td style='width:300px;height:30px;'>
<div class='content'>
</div>
<div class='content2'>
</div>
</td>
</tr>
</table>
谢谢,
【问题讨论】:
标签: html css internet-explorer internet-explorer-11