I am having trouble getting the images to properly fit inside the card. Even when I set the width to 100%, they are not adjusting correctly. Can anyone provide guidance on how to fix this issue?
Thank you
Below is the HTML code for the card:
.card {
margin-right: 25px;
margin-top: 25px;
margin-left: 25px;
border: 2px solid black;
}
.card-img-top {
width: 100% !important;
/* takes the 100 % width of its container (.box div)*/
object-fit: contain;
}
<div class="card" style="width: 18rem;">
<img src="https://i.sstatic.net/ToKWh.png" class="card-img-top" alt="Card image">
<div class="card-body">
<h5 class="card-title">Destiny 2</h5>
<ul>
<li>
Developer: Bungie
</li>
<li>
Genre: First-person shooter, MMOG
</li>
<li>
Release Date: 2017
</li>
</ul>
<a href="#" class="btn btn-warning">More</a>
<a href="#" class="btn btn-success">Add to Favorites</a>
</div>
</div>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="13717c7c67606761726353273d233d23">[email protected]</a>/dist/css/bootstrap.min.css">