我有一个表格结构,我需要嵌套元素来获取表格单元格 div 的所有大小。所以我把它设置为绝对值并将它的所有位置定义为 0,它在 FireFox 和 Chrome 上工作得很好,但在 IE 上却没有:(
这是标记:
<div class="table">
<div class="cell">
<figure class="illustration">My illustration</figure>
</div>
</div>
CSS :
.table {
display: table;
width: 400px;
}
.cell {
position: relative;
display: table-cell;
height: 600px;
background-color: grey;
}
.illustration {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: red;
color: #fff;
}
这是我的笔:
http://codepen.io/balix/pen/qEMwzj
如果你看到红色背景就可以了 ;)
任何 IE 黑客?
最佳答案
我有同样的问题。
如果有人仍在寻找解决方法,您需要在 .cell 中创建一个容器
.cell > div{
height:100%;
width:100%;
position:relative;
}
关于html - 使用 Internet Explorer 在表格单元格中定位绝对值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28961722/