我正在尝试使用flexbox CSS 来实现一些东西。 我只想要兼容 Chrome&火狐即可。 我可以在FF中执行此操作,但无法在 Chrome 中使用。 我想要的是递归插入垂直框中心。你可以看看here。
div.contenaireBlc {background:#FFF; border:1px solid #ddd;
width:250px; height:250px;margin:0 30px 0 0;}
.contenaireHori {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
-webkit-flex-direction: column;
-webkit-flex-wrap: nowrap;
background:#777;
height:100%;
width:100%;
}
.innerTop{
-webkit-flex: 1 1 50%;
flex: 1 1 50%;
background: green;
width: 100%;
}
.traversHori{
flex: 0 0 20px;
-webkit-flex: 0 0 20px;
background: blue;
width: 100%;
}
.innerBottom{
-webkit-flex: 1 1 50%;
flex: 1 1 50%;
background: red;
width: 100%;
}
在 chrome 中,第二个红色&绿色框具有 height = 0px ,适当占据左侧空间(每个50%)。