我们有两个带内容的div和一个绝对定位的背景div。
容器是一个flexbox。
在Chrome和Safari中都正常工作,但是Firefox和IE11会考虑到绝对定位的div,并像有3个div在一行中一样分配空间。
容器是一个flexbox。
在Chrome和Safari中都正常工作,但是Firefox和IE11会考虑到绝对定位的div,并像有3个div在一行中一样分配空间。
我已经创建了一个jsfiddle示例。是否有任何方法可以修复这个bug? 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>