What is the Best Way to Ensure Consistent Image Heights in a Bootstrap Row?

I am struggling with aligning the heights of three images in the same row while preserving their aspect ratio. I attempted to use 'display: flex;' for the parent container (.carousel-content-container) and assign 'flex' property based on the image's aspect ratio, but it seems to conflict with Bootstrap columns. Do you have any suggestions that could solve this issue without resorting to a hacky solution?

Any assistance on this matter would be greatly appreciated! Check out the problem by following the link below.

View the image

HTML (Carousel section):

<section class="portfolio-section">

        <div id="carouselExampleControls" class="carousel slide" data-interval="false" data-ride="false">

         <div class="carousel-inner">
            <div class="carousel-item active container-fluid">
              <div class="row">
                <div class="col-lg-5 col-md-5 carousel-content-container">
                  <img src="./imgs/art/the_beach.png" alt="beach img">
                </div>
                <div class="col-lg-4 col-md-4 carousel-content-container">
                  <img src="./imgs/art/joyce3.jpg" alt="joyce img">
                </div>
                <div class="col-lg-3 col-md-3 carousel-content-container">
                  <img src="./imgs/art/flower.jpeg" alt="flower img">
                </div>
              </div>
            </div>
            ... OTHER CAROUSEL ITEMS

         ... CAROUSEL PREVIOUS AND NEXT SLIDE BUTTONS

    </section>

CSS:

.portfolio-section .container-fluid {
  background-color: #342b38;
  padding: 7% 5%;
  color: white;
  text-align: center;
}

.portfolio-section .carousel-content-container img {
  width: 100%;
  padding: 0;
  box-shadow: 5px 5px 5px 0px #1f1921;
}

.portfolio-section .carousel-inner{
  height: 20%;
}

.portfolio-section .row {
  border: 1px solid blue;
}

.portfolio-section .col-lg-5, .col-lg-4, .col-lg-3 {
  border: 1px solid red;
}

Answer №1

When setting all images to width: 100%, it's crucial to prioritize either height or width to prevent stretching.

Consider using min-height and/or max-height properties for better size control.

To ensure dynamic width of Bootstrap containers, utilize col-md-auto.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Elevation on Tab button from the upper side

On my website, I have a large form where pressing the tab key switches between input fields. The inputs will also jump to the top if we reach the bottom of the form. The issue is that I have a fixed header at the top, covering the first 60px. Is there a w ...

Tips for positioning text next to a hyperlink using HTML or CSS

Is there a way to align text next to a link without it being part of the link itself? For instance, text - link That's how I'd like it to appear ...

What are the reasons for the failure of an image upload when checked with PHP's is_uploaded_file function?

My html form allows users to upload images, but I'm encountering an issue where the uploaded image fails the "is_uploaded_file" check for some unknown reason. I'm puzzled as to why the upload is failing the is_uploaded_file check. Any ideas? He ...

Concealing two out of three div elements inside a specified id container using jQuery

I have encountered an issue with my structure, which looks like this: http://jsfiddle.net/NEFhF/3/ This is how it should work: When I click on the "id contacts", the "field body" and the "field foot" should be hidden. However, the id and the field head b ...

Tips on how to show the image icon in place of the image name

Here is a code snippet for multiuploading images using Vue. Currently, the uploaded images are displayed by their file names. However, I am looking to enhance this functionality by displaying an image icon instead of the file name. If anyone knows how to ...

Guide on searching for user-input values using the Wikipedia API

As a newcomer to the world of programming and web development, I am struggling with understanding how to properly utilize Ajax/JSON. My current set-up involves HTML and jQuery, with a text input field and a submit button for searching. The goal is to have ...

parsing the data from an HTML document containing embedded variables

Is there a more efficient way to use file_get_contents() on an html file containing 3 variables and have those variables populated with data from $_POST? For example: -html file- <html> . . <table> <tr> <td> ...

Creating a connection between a Flutter mobile app and a Django web app

My current project involves a Django web app designed as a repository for alumni information. Users can register using the extended user model and input various details, which are then displayed on individual detail pages. The functionality of the app is i ...

Is there a way to position the navbar at the bottom of the page?

Is there a way to position this navbar at the bottom of the page? I've tried using different properties like bottom or margin-bottom, but it doesn't seem to work. Could there be a CSS configuration preventing these commands from taking effect? H ...

Utilizing Google Maps API to dynamically input destinations in text boxes

Check out my code at this link: I apologize for the inconvenience, but I had some difficulty pasting it directly into this forum. The code is functioning well, however, I need assistance with a particular issue. Currently, the textboxes for start and des ...

Issue with ng-repeat causing problems with Bootstrap table functionality

<div ng-controller="reportCtrl"> <table class="table table-hover"> <thead class="row col-md-3"> <tr class="row"> <th class="col-md-6">Key </th> <th cla ...

When a radio button is clicked in Angular7 and it shares the same form control name, both radio buttons are being

Visit this StackBlitz link for more information. places = ['effil tower','new discover'] new FormGroup({place: new FormControl()}); <div *ngIf="places?.length > 0" class="col-12"> <div style=" padding-top: 1e ...

Is there a way to determine the remaining time between the present moment and a specific time in JavaScript?

Here's a snapshot of the snippetI have this great idea for a prayer app that can calculate the time remaining between the current time and the scheduled prayer times. My initial approach was to directly find the difference using the following code: ...

Tips for efficiently implementing AJAX requests for multiple forms within a single webpage

Previously, I had a form where clicking submit would hide the form and display the result on a div with classname=dig. However, after adding more forms, all the forms started submitting at the same time instead of individually. How can I fix this issue in ...

Is it possible to reposition the Bootstrap Table Paginator?

Currently, I am utilizing the CSS from Bootstrap Table. My goal is to relocate the text and page size indicators, as shown in the following example, from the bottom of the table to the top. You can view an illustration here. Displaying 1 to 20 of 159 e ...

Utilizing a smooth carousel with an equal number of slides for display

I have a slick slider set to Center Mode with an even number of slidesToShow. The goal is to have the active slides at full opacity (1) and inactive slides at half opacity (0.5). However, due to the even number of slides, the implementation is not working ...

Problem with Safari: File downloaded with name "Unknown" due to Javascript issue

After successfully converting my data to text/csv, I can easily download the file in Chrome. However, when attempting to do so in Safari on an iPad or Mac, it opens a tab with the name "unknown" or "Untitled". The code snippet I am using for this is as fol ...

Can data be pulled from parse.com using Objective-C and then displayed on a website?

I am currently using parse.com as a backend service for my iOS app and have hired someone to create a website interface using HTML and CSS. Despite parse.com offering different options for sharing data between the app and website, such as through a JavaScr ...

Include JavaScript within the header section

It is commonly recommended to include .js files in the head section of HTML for good practice. The issue I am facing is that one of my .js files (or code+script) contains a function called beginning, and it is structured like this (now all placed in the h ...

What is the best way to restrict user input to specific numbers only?

I have a text input field, how can I ensure that only numeric values from 1 to 31 are allowed? <input type="number" min="1" max="31"> ...