css - How to specify row height of multi-line flexbox layout and have remaining rows stretch -
i have multi-line flexbox layout specify height of 1 of rows , have remaining rows stretch fill. if set height of blue div below, bunch of empty space.
#container { display: flex; flex-wrap: wrap; height: 500px; width: 500px; } #one, #two, #four, #five { flex: 1 1 49%; } #three { flex: 1 1 99%; background-color: blue; height: 15px; max-height: 15px; } #one { background-color: green; } #two { background-color: yellow; } #four { background-color: orange; } #five { background-color: violet; }
<div id="container"> <div id="one"></div> <div id="two"></div> <div id="three"></div> <div id="four"></div> <div id="five"></div> </div>
as far know, require rows.
#container { display: flex; flex-wrap: nowrap; height: 500px; width: 500px; flex-direction: column; } .row { flex: 1 0 auto; display: flex; flex-direction: row; } .row:nth-child(2) { height: 15px; max-height: 15px; } .row div { flex: 1 0 auto; } #one { background-color: green; } #two { background-color: yellow; } #three { background-color: blue; } #four { background-color: orange; } #five { background-color: violet; }
<div id="container"> <div class="row"> <div id="one"></div> <div id="two"></div> </div> <div class="row"> <div id="three"></div> </div> <div class="row"> <div id="four"></div> <div id="five"></div> </div> </div>
Comments
Post a Comment