我想使用带有列布局的flexbox,但我希望将顶部n - 1弹性项目固定到顶部,将nth弹性项目固定到主要弹性容器区域的底部.
我通过使用nthflex项目来解决这个问题也是一个新的flexbox/flex容器使用justify-content: flex-end,但我找不到任何这样做的例子 - 所以这是一个正确/可接受的解决方案,根据标准,如果没有,如何我会用flexbox来解决这个问题吗?
这是一个简单的例子:
.flex-container {
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
width: 300px;
height: 240px;
background-color: Silver;
}
.flex-container-bottom {
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
width: 300px;
height: 240px;
background-color: orange;
-webkit-justify-content: flex-end;
-ms-flex-pack: end;
justify-content: flex-end;
}
.flex-item {
background-color: DeepSkyBlue;
width: 100px;
height: 100px;
margin: 5px;
}
.flex-item-bottom {
background-color: red;
width: 100%;
height: 50px;
}Run Code Online (Sandbox Code Playgroud)
<div class="flex-container">
<div class="flex-item">flex item 1</div>
<div class="flex-item flex-container-bottom">
<div class="flex-item-bottom">flex item 2</div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)