【发布时间】:2016-01-04 14:46:08
【问题描述】:
我们有两个带有内容的 div 和第三个带有绝对位置的背景的 div。
容器是一个弹性盒子。
在 Chrome 和 Safari 中一切正常,但 Firefox 和 IE11 会考虑绝对定位的 div,并在 div 之间分配空间,就像连续 3 个 div 一样。
我制作了 jsfiddle 示例。有没有办法修复这个错误? https://jsfiddle.net/s18do03e/2/
div.container {
display: flex;
flex-direction: row;
width: 100%;
height: 300px;
justify-content: space-between;
width: 100%;
outline: 1px solid;
}
div.c1 {
background: #aaeecc;
width: 100px;
position: relative;
z-index: 50;
top: 20px;
display: flex;
}
div.c2 {
background: #cceeaa;
width: 200px;
position: relative;
z-index: 50;
top: 20px;
display: flex;
}
div.bg {
background: #ccc;
width: 100%;
height: 100%;
z-index: 0;
left: 0px;
top: 0px;
position: absolute;
display: flex;
}
<div class="container">
<div class="c1">Content 1</div>
<div class="c2">Content 2</div>
<div class="bg">Background</div>
</div>
【问题讨论】:
-
截至 12 月的 flex-container 内的绝对定位。 2019:codepen.io/ekadagami/pen/mdyPybq
标签: html css flexbox internet-explorer-11