I am coding an angular project and am using bootstrap 5.
I am having an issue with card-img-top
, as for every image the user uploads that is a different resolution, the image height is different. I need to achieve that every image has the same width and height ratio or whatever as every other one.
For instance: https://carsandbids.com/ has the desired look
Below I have provided code for a card.component.html file and its parent component. card.component.html
<div class="card h-100 content-container">
<img src="{{auction?.imagePath}}" alt="Item Image" class="card-img-top img-fluid">
<div class="card-body p-0">
<div class="my-4">
<h5 class="card-title m-0 p-0">{{auction?.title}}</h5>
<p class="card-text"><span class="badge badge-primary m-0" *ngIf="auction?.noReserve">No Reserve</span>
{{auction?.discription}}</p>
<p class="card-text text-muted m-0 p-0">{{auction?.location}}</p>
</div>
</div>
</div>
Here is the parent component file
<main class="live-auctions col">
<div class="auction-container">
<div class="auction-thumbnail row g-2" *ngIf="liveAuctions != undefined && liveAuctions.length != 0">
<app-auction-card *ngFor="let auction of liveAuctions" [auction]="auction"></app-auction-card>
</div>
<div class="no-auctions" *ngIf="liveAuctions == undefined || liveAuctions.length == 0">
<p class="text-center text-muted">No Auctions Available</p>
</div>
</div>
</main>
Tried various solutions, tried h-auto, h-100, img-fluid, img-thumbnail