假设您的意思是弹性项目下方的空间是上方空间的 3 倍,您可以添加带有flex-grow1 和 3 的伪元素:
#container {
display: flex;
flex-direction: column;
height: 200px;
background: #aaf;
}
#container > div {
height: 50px;
background: #afa;
}
#container::before {
content: '';
flex: 1;
}
#container::after {
content: '';
flex: 3;
}Run Code Online (Sandbox Code Playgroud)
<div id="container">
<div>Content</div>
</div>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
847 次 |
| 最近记录: |