Bootstrap 4: Filling Remaining Height in Rows
In Bootstrap 4, creating a row that fully occupies the remaining vertical space can be challenging. By default, adding the h-100 class to the row will not work as intended.
Solution: Flexbox
To make a row stretch to fill the remaining height, utilize the Bootstrap 4.1 flexbox property flex-grow-1. This class allows an element to grow to fill the remaining available space in its container.
Implementation
Here's how to implement the solution:
Example Code
<div class="container-fluid h-100"> <div class="row justify-content-center h-100"> <div class="col-4 bg-red"> <div class="h-100 d-flex flex-column"> <div class="row justify-content-center bg-purple"> <div class="text-white"> <div>
Result:
The blue row (ROW 2) will now expand to fill the remaining height of the red column.
The above is the detailed content of How to Make a Bootstrap 4 Row Fill Remaining Height?. For more information, please follow other related articles on the PHP Chinese website!