Is there a way to keep the images in my cards fixed at the top of the card body? I've tried using bottom: 0 but it's not working as expected. The card body has a fixed height and is fixed to the bottom, which is functioning correctly. However, since the images have different sizes and will scale differently, I want them to be fixed at the top instead. Can someone please assist me?
<div class="card" style="width: 18rem;">
<img class="card-img-top fluid-img" src="briefcase.png" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Suit</h5>
<p class="card-text">Professional, business executive look.</p>
<p class="text-center">€299</p>
<a href="#" class="btn btn-success btn-block">Add to cart</a>
.card-img-top {
width: 100%;
border-top-left-radius: calc(0.25rem - 1px);
border-top-right-radius: calc(0.25rem - 1px);
}
.card {
position: relative;
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
min-width: 0;
height: 650px;
word-wrap: break-word;
background-color: #fff;
background-clip: border-box;
border: 1px solid rgba(0, 0, 0, 0.125);
border-radius: 0.25rem;
}
.card-body {
-ms-flex: 1 1 auto;
flex: 1 1 auto;
padding: 1.25rem;
bottom: 0;
position: absolute;
}
<div class="card" style="width: 18rem;">
<img class="card-img-top fluid-img" src="briefcase.png" alt="Card image cap">
<div class="card-body">
<h5 class="card-title">Suit</h5>
<p class="card-text">Professional, business executive look.</p>
<p class="text-center">€299</p>
<a href="#" class="btn btn-success btn-block">Add to cart</a>
</div>
</div>