Topic: Cards of same height and footer bottom alignment
ales pro asked 7 years ago
rangrage free answered 7 years ago
Hi,
I have tried the example above using MDB 4.4.1, I've changed the card-block to card-body etc. but it is making all cards stretch beyond the screen height.
Can you please let me know if this still works for MDB 4.4.1? I am using twig for the template, if that makes any difference.
P.S. It would be nice if we could simply add a "match-height" class on a card.
Marta Wierzbicka staff answered 7 years ago
mshallop pro answered 7 years ago
Marta Wierzbicka staff answered 7 years ago
.card {
height: 100%;
display: flex;
}
.card-block {
display: flex;
justify-content: space-between;
flex-direction: column;
}
.card.card-footer {
align-self: flex-end;
flex: 1 1 auto;
}
And then you need to add one <div>
in your card like here:
<!--Card-->
<div class="card card-cascade wider">
<!--Card image-->
<div class="view overlay hm-white-slight">
<img src="https://mdbootstrap.com/img/Photos/Horizontal/E-commerce/Products/shoes%20(3).jpg" class="img-fluid" alt="">
<a>
<div class="mask waves-effect waves-light"></div>
</a>
</div>
<!--/.Card image-->
<!--Card content-->
<div class="card-block text-center">
<div class="mb-1">
<!--Category & Title-->
<a href="" class="text-muted"><h5>Shoes</h5></a>
<h4 class="card-title"><strong><a href="">Pink sneakers</a></strong></h4>
<!--Description-->
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing minima veniam elit. Nam incidunt eius est voluptatibus.
</p>
</div>
<!--Card footer-->
<div class="card-footer">
<span class="left">39$</span>
<span class="right">
<a class="" data-toggle="tooltip" data-placement="top" title="Quick Look"><i class="fa fa-eye"></i></a>
<a class="" data-toggle="tooltip" data-placement="top" title="Add to Wishlist"><i class="fa fa-heart"></i></a>
</span>
</div>
</div>
<!--/.Card content-->
</div>
<!--/.Card-->
Best,
Marta
aliveli free commented 7 years ago
Hello Marta, I've tried the steps you've provided but the button on the card-footer is not going to the bottom. https://pastebin.com/U7xSKAcNMarta Wierzbicka staff commented 7 years ago
Hi, I see the code but I don't see your demo, could you provide one here? Best, Martaaliveli free commented 7 years ago
Hello Marta, You can check this website: http://digitaltestsite2.biz/Marta Wierzbicka staff commented 7 years ago
Hi, try the code from here: https://github.com/mdbootstrap/bootstrap-material-design/issues/125 .FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: Yes