I have a swiper containing Bootstrap cards, populated from a dynamic data source (though this is probably not relevant). I would like the cards to be of equal height but haven’t managed to achieve this yet.
I don’t think I can put the cards into a card-group which might be one way. I’ve also tried assigning class align-self-stretch to the card - no luck, nor with w-100. I’ve tried adding these classes to various parts of the card…
I would be grateful for any suggestions.
PS one thing that sort of works is assigning a fixed height to the card div. Not a very satisfactory solution.
Thanks @Hyperbytes. I tried that but it didn’t make any difference. It’s possible I did something stupid so I’ll try this again later (I’m not in my office at the moment).
Hi Teodor,
I haven’t used a swiper with dynamic content - so I could be doing something wrong - but it seemed straightforward and works fine, apart from the height. This is the code:
I fiddled around with it quite a bit, but I think I’ve removed my experimental CSS. I made a slight change to centre the button at the bottom of the card - I think that’s all.
I don’t see how I can wrap the cards in <div class="card-group"> - which would be one way of getting the desired result. Obviously if I put this above <div class="card">, it’s going to wrap each card div, not the group of cards. If I put it outside the repeat, then the swiper divs/classes will get in the way.
Many thanks Teodor - that’s fixed it. This is really helpful as I can think of various cases where I might use cards in a swiper - and they would need to have the same height.
I had tried adding h-100 to the class (not w-100 as I mentioned at the beginning), but don’t think I would have thought of trying height:auto too.