What I want to achieve:
Equal height columns direct childs, so gaps will be visible between columns (first solution in Codepen but it fails on Safari (Mac)).
or (if that's possible)
Equal height Bootstrap columns with visible gaps between them (If I set background color to
col
class divs - gaps are not visible because of padding - you can see that in Codepen).
What I have tried:
- Setting
h-100
class (height: 100%
) to columns direct childs but it fails on Safari (see StackOverflow question). - Using horizontal
margins
oncol
divs instead ofpadding
but it breaks Bootstrap's grid system.
CODEPEN
HTML:
<div class="container">
<h3>This is how it should work - fails on Safari (Mac)</h3>
<div class="row">
<div class="col-4">
<div class="inner h-100">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
</div>
<div class="col-4">
<div class="inner h-100">Inner</div>
</div>
<div class="col-4">
<div class="inner h-100">Inner</div>
</div>
<div class="col-4">
<div class="inner h-100">Inner</div>
</div>
<div class="col-4">
<div class="inner h-100">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.</div>
</div>
</div>
</div>
<div class="container">
<h3>Backgrounds applied to col divs (gaps are not visible because of cols padding)</h3>
<div class="row no-gutters">
<div class="col-4 bg">
<div class="inner">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
</div>
<div class="col-4 bg">
<div class="inner">Inner</div>
</div>
<div class="col-4 bg">
<div class="inner">Inner</div>
</div>
<div class="col-4 bg">
<div class="inner">Inner</div>
</div>
<div class="col-4 bg">
<div class="inner">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.</div>
</div>
</div>
</div>
<div class="container">
<h3>Basic Bootstrap HTML</h3>
<div class="row">
<div class="col-4">
<div class="inner">Lorem Ipsum is simply dummy text of the printing and typesetting industry.</div>
</div>
<div class="col-4">
<div class="inner">Inner</div>
</div>
<div class="col-4">
<div class="inner">Inner</div>
</div>
<div class="col-4">
<div class="inner">Inner</div>
</div>
<div class="col-4">
<div class="inner">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.</div>
</div>
</div>
</div>
CSS:
.inner,
.bg {
background: #ddd;
}
.h-100 {
height: 100%;
}