I've been on the hunt for a solution to this issue, but I haven't had any luck finding one.
Various flexbox
properties like flex-grow: 1;
and align-self: stretch;
have been attempted, but none seem to achieve the desired outcome.
The goal is to make the last column stretch and occupy the remaining height in the row.
Despite making adjustments based on suggestions, it still falls short of what I'm aiming for.
(The blue box represents the element that needs to stretch)
Take a look at the code snippet below:
.product {
border: 1px solid rgba(0,0,0,.2);
padding: 15px;
height: 100%;
}
.product .image {
padding-bottom: 100%;
background: rgba(255,0,0,.2);
margin-bottom: 15px;
}
.product .content {
border: 1px solid blue;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-4">
<div class="product">
<div class="image"></div>
<div class="content">
The height of this is dynamic.
</div>
</div>
</div>
<div class="col-4">
<div class="product">
<div class="image"></div>
<div class="content">
It can vary from product to product, but I would like this class to stretch.
</div>
</div>
</div>
<div class="col-4">
<div class="product">
<div class="image"></div>
<div class="content">
To fill the rest of the columns height.
</div>
</div>
</div>
</div>
</div>