I have a list article in my blog. Show three columns.
The problem is: when the title of the article has 3 line. The columns are pushed down if have 4 article.
Like this:
article 1 article 2 article 3
article 4
It should be like:
article 1 article 2 article 3
article 4
My code like:
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<div class="row">
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>10 The article have 2 line, it will break four item in this </h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
<div class="col-sm-6 col-md-4 col-lg-4 pb-90">
<div class="post-prev-title">
<h3>New trends in web design</h3>
</div>
<div class="mb-30">
Maecenas volutpat, diam enim sagittis uam, id porta ulamis. Sed id dolor consectetur fermentum nibh vomat
</div>
</div>
</div>
</div>
Note: click run code -> full page to show.
Or see my pen: https://codepen.io/vanloc/pen/RZqVXR
Have any method to resolve this problem?
The title is defined by the user, I can’t control that.
2
Answers
You can use a clearfix div to set the row correctly if the heights are uneven!
An example of that is documented here: https://getbootstrap.com/docs/3.3/css/#grid-responsive-resets
Or if you can use a LESS/SCSS mixin, that’s demonstrated here: https://getbootstrap.com/docs/3.3/css/#less-mixins-clearfix
Here is that code snippet with the clearfix in. Please let me know if this isn’t the solution you were looking for. Thanks!
You can Try Something Like This. Using this Multiline Ellipses
CSS