I'm trying to make a grid of thumbnails, where each thumbnail has an image and a label. It works fine if all the labels have the same length, because then all the thumbnails have the same height:
http://www.bootply.com/iSqwWyx5ms
However, if I shorten the rightmost thumbnail's text, part of the row below gets pushed into a new row, as shown here:
http://www.bootply.com/Wqd021aaeM
What I would like is the second row to start from the lowest point in which the first row ended.
I know I can solve it with JavaScript - find the longest thumbnail in each row and set the other thumbnails to have that height. Question is, do I have any way of doing it, or something else that can solve my problem, using only with CSS?
Update: I don't know beforehand how many items I have in one row. For example, on a small screen I'd have 2 items in a row, while on a bigger screen it'll be 3, so solutions which set when a new row starts aren't good for me.
CSS grid and bootstrap grid can work together perfectly. Rather than pit them against each other, it's up to you to find a way to blend these two powerful grids.
If you're layout-first, meaning you want to create the layout and then place items into it, then you'll be better off with CSS Grid. But if you're content-first, meaning you have items that you want to place into a container and space out evenly, go with Bootstrap.
Go to the Customize menu on Bootstrap website and choose your preferred size. In Less Variables -> Grid system you can find a form to input your preferred sizes. Then you can easily download the preferred grid. Hope this will help.
offset-md-3 which will offset the desired column element with 3 columns to the right from its default position on medium screen sizes and above. . offset classes always shifts its content to the right. This all stuff produced results .
You should use .clearfix
, as described at the Grid responsive resets section of the Bootstrap documentation: https://getbootstrap.com/docs/3.3/css/#grid-responsive-resets
If you don't know how many columns you have, you can do:
.row.fix { display: flex; flex-wrap: wrap; width:100%; /*not always necessary*/ }
Working fiddle: https://jsfiddle.net/wqdm1jjt/
Example:
Author: Juan Miguel
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With