Html 使用Internet Explorer在表格单元格中定位绝对值
我有一个表结构,我需要嵌套元素来获取表单元格div的所有大小。因此,我将其设置为绝对值,并将其所有位置定义为0,它在FireFox和Chrome上非常有效,但在IE上不起作用:( 以下是标记:Html 使用Internet Explorer在表格单元格中定位绝对值,html,css,internet-explorer,css-position,Html,Css,Internet Explorer,Css Position,我有一个表结构,我需要嵌套元素来获取表单元格div的所有大小。因此,我将其设置为绝对值,并将其所有位置定义为0,它在FireFox和Chrome上非常有效,但在IE上不起作用:( 以下是标记: <div class="table"> <div class="cell"> <figure class="illustration">My illustration</figure> </div> </div&
<div class="table">
<div class="cell">
<figure class="illustration">My illustration</figure>
</div>
</div>
这是我的钢笔:
如果您看到红色背景,则可以;)
对IE有什么意见吗?这不是位置问题,你的身材只有零高度。我只是简单地将
height:300px
插入插图
类,现在它在IE上运行良好:
.illustration {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: red;
color: #fff;
height: 300px;
}
在真正的代码中,您肯定会在figure
标记中有一些图像,因此应该没有问题。我也有同样的问题。
如果有人仍在寻找解决方法,您需要在.cell中创建一个容器
.cell > div{
height:100%;
width:100%;
position:relative;
}
.cell > div{
height:100%;
width:100%;
position:relative;
}