Reputation: 263
How do I stretch this div in this column to be the same height as the one on the right?
I'm using bootstrap v4 and rails and I'm just losing my mind over this simple task. They're div's, in two separate columns, in one row. Ugh.. Appreciate ya!
<div class="row justify-content-center" style="width:98vw">
<div class="col-md-4 col-sm-6 col-10">
<div class="booyah-black">
Column 1 content
</div>
</div>
<div class="col-md-4 col-sm-6 col-10">
<div class="booyah-black">
Column 2 content
</div>
</div>
</div>
Upvotes: 0
Views: 1168
Reputation: 3085
Setting the column content height to 100% should work for you. I tested with code snippet you shared, but if you are still facing the problem you can share with HTML-CSS-JavaScript playgrounds(codepen.io/jsfiddle.net)
.booyah-black {
height: 100%;
}
Modified Html
<div class="row justify-content-center">
<div class="col-md-4 col-sm-6 col-10">
<div class="booyah-black" style="background:red">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
<div class="col-md-4 col-sm-6 col-10">
<div class="booyah-black" style="background:yellow">
Column 2 content
</div>
</div>
</div>
Upvotes: 0
Reputation: 2071
You have to do two modification in your code. col-md-4 col-sm-6 col-10
to col-12 col-sm-6 col-md-4 d-flex flex-row
.
HTML
<div class="row justify-content-center" style="width:98vw">
<div class="col-md-4 col-sm-6 col-12 d-flex flex-row">
<div class="booyah-black">
Column 1 content
</div>
</div>
<div class="col-md-4 col-sm-6 col-12 d-flex flex-row">
<div class="booyah-black">
Column 2 content
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
</div>
</div>
CSS
.booyah-black{
background-color: green;
color: white;
padding: 20px;
width: 100%; /* This is important to fix your issues. */
}
See the Demo
Upvotes: 0
Reputation: 362360
Use h-100
on the inner div...
<div class="row justify-content-center" style="width:98vw">
<div class="col-md-4 col-sm-6 col-10">
<div class="booyah-black h-100">
Column 1 content
</div>
</div>
<div class="col-md-4 col-sm-6 col-10">
<div class="booyah-black h-100">
Column 2 content
</div>
</div>
</div>
Upvotes: 1
Reputation: 66
align-items: stretch
or justify-items: stretch
should do the trick
Upvotes: 0