I am new to web design and struggling with resizing images using the img-fluid class in a particular portfolio view where they function as thumbnails. I will upload some images to clarify my goal. The challenge is maintaining consistency in size for each image displayed, especially when one has greater vertical height compared to others, causing resolution discrepancies and layout issues.
The second image highlights this issue, where one taller image disrupts the alignment of surrounding elements.
Below is the HTML code:
<div class="container-fluid">
<div class="row">
<div class="col-lg-4 col-sm-6 mb-2">
<!-- Portfolio item -->
<div class="portfolio-item">
<a class="portfolio-link" href="someurl">
<div class="portfolio-hover">
<div class="portfolio-hover-content"><i class="fas fa-plus fa-3x"></i></div>
</div>
<img class="img-fluid" src="sourceofimage" alt="default" height=auto/>
</a>
<div class="portfolio-caption">
<div class="portfolio-caption-heading">some text</div>
<div class="portfolio-caption-subheading text-muted">some text</div>
</div>
</div>
</div>
</div>
</div>
And here is the CSS for img-fluid:
.img-fluid {
max-width: 100%;
height: auto;
}
If anyone can offer assistance with this issue, it would be greatly appreciated.