0
Good night.
I’m using Bootstrap4 in my Django project, but as in the following print, there’s a gap between cards (marked with an x) because of their different size. I would like the images below to fit naturally (as occurs on Pinterest, for example).
I’ve been taking a look at the basic Bootstrap documentation but I couldn’t find a suitable solution to eliminate this space. To create this page I am guided by the example Album. Follow the code I have now, and that generates that printscreen:
{% for l in lores %}
<div class="col-md-3">
<div class="card mb-4 shadow-sm">
<div>
<a href="{% url 'lore_detail' pk=l.pk %}"><img class="card-img-top" src="{{l.image.url}}"></a>
<div class="card-body">
<p class="card-text">{{ l.title }}</p>
</div>
</div>
</div>
</div>
{% endfor %}
This is my Django’s, and it’s working correctly (sorry for the identation, in the copy to here it got weird.)
With native bootstrap you will not be able to make them fit, as much as you will be able to and leave them all at the same height, so there is no empty space, but everyone is the same height. If you want them to fit, look over mansori layout that I think might be what you want
– hugocsl
https://masonry.desandro.com/
– hugocsl