我们有两个带内容的div和第三个div,它是具有绝对位置的背景。
Container是一个flexBox。
一切都可以在Chrome和Safari中正常工作,但Firefox和IE11在绝对定位div中有所影响,并且在div之间分配空间,就像连续有3个div一样。
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;
}
Content 1
Content 2
Background