【发布时间】:2015-12-09 17:59:20
【问题描述】:
关于在父显示中定位绝对 div 的快速问题:IE 中的表格单元格。
我已经创建了我正在尝试创建的布局的 jsfiddle,它在 chrome 和 firefox 中工作,但在 IE 中它破坏了子级的 .list-container 绝对高度(这是 se在具有 display: table-cell 的父级内部时填充从顶部 118px 向下的所有空间。
我是否缺少任何 IE 样式规则来帮助它呈现绝对的孩子?这在 IE 中是可能的吗?
html, body{
height:100%;
margin:0;
padding:0px;
}
.table{
display : table;
width : 100%;
height : 100%;
}
.row{
display : table-row;
width : 100%;
height : 100%;
}
.table-cell{
height:100%;
width:50%;
border:1px solid #000;
display : table-cell;
position: relative;
}
.header{
position:relative;
top:0px;
height:112px;
margin:0px;
border:3px solid blue;
background: rgba(0,0,230, .2);
}
.list-container{
position:absolute;
top:118px;
left:0px;
bottom:0px;
right:0px;
margin:0px;
overflow:auto;
overflow-x:hidden;
border:3px solid #CCC;
background: rgba(0,0,0,.1);
}
<body>
<div class="table">
<div class="row">
<div class="table-cell">
<header class="header"></header>
<div class="list-container">
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>
</div>
<div class="table-cell">
</div>
</div>
</div>
</body>
【问题讨论】:
-
我注意到父 div.table-cell 在 chrome 和 firefox 中计算的样式是表格的全高,但在 IE 中,div.table-cell 的高度为子相对 header.header 元素。
标签: css internet-explorer position absolute tablecell