Answer the question
In order to leave comments, you need to log in
How to correctly lay out the same blocks in bootstrap?
Hello. Quite a standard problem, but I have not found a solution.
There are an indefinite number of blocks that are shown in the grid. For display, a bootstrap is used, for reasons of adaptability. (There is a requirement, 3 columns on large screens, 2 on smaller ones, 1 on mobile phones) Unfortunately, the bootstrap lined up the height of the columns as it pleased, but it is necessary that the columns in the same row be of the same size.
<div class="container row">
<div class="col-xs-12 col-sm-6 col-md-4">блабла</div>
<div class="col-xs-12 col-sm-6 col-md-4">блабла</div>
<div class="col-xs-12 col-sm-6 col-md-4">блабла</div>
<div class="col-xs-12 col-sm-6 col-md-4">блабла</div>
<div class="col-xs-12 col-sm-6 col-md-4">блабла</div>
</div>
<div class=clearfix></div>
) but the problem is that lines end differently on different devices. Answer the question
In order to leave comments, you need to log in
Simple solution:
Limit column height with max-height: XXXpx;.
And put text-overflow: ellipsis;.
On click or :hover open the entire block.
or More difficult:
Make up three columns and proportionally shove blocks across them. But this option is only suitable for a fixed layout. Flex-box
or Complex but simple:
Use masonry.js .
PS The clearfix class is used for completely different purposes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question