Every time I come across this issue, I find myself struggling without a clear solution that simplifies my life. My layout consists of 14 boxes arranged side by side. I am using the col-sm-12
class (with my bootstrap set up for 24 columns) on these boxes. However, the content within the boxes varies, causing their heights to be unequal, and the larger boxes end up "pushing" the ones adjacent to them. One straightforward solution is to insert a row after every two boxes, but here's the challenge - the boxes are dynamically generated in a loop! I could set a min-height
, but that might not look good on mobile devices (especially on landscape mode). I am also unsure about the browser support for flexbox
.
Are there any other clever hacks that I could implement?
HTML
<div class="row">
<div class=" col-xs-24 col-sm-12 col-md-12 blocks"><!--the loop starts from here-->
<div class="row">
<div class="col-sm-8"> some content</div>
<div class="col-sm-16">some more content that changes height. you can put some lorem isum in here. </div>
</div>
<!--my loop, aka, blocks, end here-->
</div>
</div>