Currently, I'm delving into Bootstrap and facing a challenge of automatically adjusting row heights under specific conditions:
- In a container-fluid, there are 3 rows
- Row1 should accommodate the height of its content
- Row3 needs to adjust to its content height and align at the bottom of the viewport
- Row2 is expected to adapt its height to fill the space between Row1 and Row3 in the container-fluid
html, body, .container-fluid {
height: 100%;
background: lightyellow;
}
.col {
border: solid 1px #6c757d;
}
.content-1 {
height: 50px;
background-color: lightcoral;
}
.content-2 {
height: 200px;
background-color: lightgreen;
}
.content-3 {
height: 25px;
background-color: lightblue;
}
<div class="container-fluid">
<div class="row">
<div class="col">
<div class="content-1">
ROW 1 -> Height of its content
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="content-2">
ROW 2 -> Height between row1 and row3 automatically adjusted
</div>
</div>
</div>
<div class="row">
<div class="col">
<div class="content-3">
ROW 3 -> Height of its content
</div>
</div>
</div>
</div>
I'd appreciate advice on the best approach to achieve this. Thanks a lot!