I'm doing a grid that will appear some products, up to 3 per line, in mobile 1 per line, the problem is that the height varies and hence in the monitors it 'pushes' one over the other.
Solution would be to put a
height: 270px
fixed, however for mobile layout I can not.
My HTML
<div class="container ">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12 grid">1 - teste de linha Gigante e sempre vai dar algum problema
<img src="http://letscode.ghost.io/content/images/2015/09/stackoverflow.png"width="350" alt="" class="img-responsive img-thumbnail">
</div>
<div class="col-md-4 col-sm-6 col-xs-12 grid">2 - teste
<img src="http://letscode.ghost.io/content/images/2015/09/stackoverflow.png"alt="" width="200">
</div>
<div class="col-md-4 col-sm-6 col-xs-12 grid">3 - teste
<img src="http://letscode.ghost.io/content/images/2015/09/stackoverflow.png"alt="" width="200">
</div>
<div class="col-md-4 col-sm-6 col-xs-12 grid">4 - teste</div>
<div class="col-md-4 col-sm-6 col-xs-12 grid">5 - teste teste teste teste teste teste teste teste teste teste teste teste teste teste teste teste teste teste</div>
<div class="col-md-4 col-sm-6 col-xs-12 grid">
1 - teste de linha Gigante e sempre vai dar algum problema
<img src="http://letscode.ghost.io/content/images/2015/09/stackoverflow.png"alt="" class="img-responsive img-thumbnail">
</div>
<div class="col-md-4 col-sm-6 col-xs-12 grid">
2 - teste
<img src="http://letscode.ghost.io/content/images/2015/09/stackoverflow.png"alt="" width="200">
</div>
<div class="col-md-4 col-sm-6 col-xs-12 grid">
3 - teste
<img src="http://letscode.ghost.io/content/images/2015/09/stackoverflow.png"alt="" width="200">
</div>
</div>
</div>
Example on the fiddle link In the fiddle it is difficult to visualize the big screen, to see how it twists.
I tried to do it through: But I think I must have confused something, it should work.
@media (min-width: 768px) {
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
max-height: 146px !important;
}
}
@media (min-width: 992px)
{
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12 {
max-height: 250px !important;
}
}
But without success.
Update [18/05/2016]
It has been proposed to use <div class="row"
> to every 12 elements.
But if I have an option that varies by device, that is to -md-
screen would be every 3 items a row
, but to screen -sm-
every 2 items and to -xs-
1 item per row. / p>