讓 Flexbox 版面配置剩餘的垂直空間
Flexbox 版面的第三行需要動態擴充以填入瀏覽器視窗的剩餘高度。為此,請採取以下步驟:
.wrapper, html, body { height: 100%; margin: 0; } .wrapper { display: flex; flex-direction: column; } #row1 { background-color: red; } #row2 { background-color: blue; } #row3 { background-color: green; flex:2; display: flex; } #col1 { background-color: yellow; flex: 0 0 240px; min-height: 100%; /* Chrome needed this initially */ } #col2 { background-color: orange; flex: 1 1; min-height: 100%; /* Chrome also needed this at one point */ } #col3 { background-color: purple; flex: 0 0 240px; min-height: 100%; /* Chrome might need this for a bit */ }
以上是如何讓 Flexbox 行填滿瀏覽器視窗中剩餘的垂直空間?的詳細內容。更多資訊請關注PHP中文網其他相關文章!