Equal height images using Bootstrap 4

Is there a way to display images with the same height but different width in a row while maintaining responsiveness?

For instance, I would like to showcase 3 images side by side in a row, ensuring that each image has a consistent height.

<div class="row">
  <div class="float-left">
    <img src="img1.png" class="??">
  </div>
  <div class="float-left">
    <img src="img2.png" class="??">
  </div>
  <div class="float-left">
    <img src="img3.png" class="??">
  </div>
</div>

Answer №1

Choose a specific dimension, such as 5, and then type

<img src="image.png" height="5" width="5">

Answer №2

Adaptive approach implemented.

Utilizing media queries to adjust image height based on screen dimensions.

While not completely responsive, images will maintain consistent height across various screen sizes within their container.

HTML (HAML):

.row.my-list
  .card.d-flex.align-items-stretch.align-self-center
    %img.card-img-top{:src => "img1.png"}/
  .card.d-flex.align-items-stretch.align-self-center
    %img.card-img-top{:src => "img2.png"}/
  .card.d-flex.align-items-stretch.align-self-center
    %img.card-img-top{:src => "img3.png"}/

CSS (SASS):

.my-list{
  .card{
    border: 0;
  }

  img{
    @include media-breakpoint-down(sm) {
      height: 40px;
    }

    @include media-breakpoint-up(md) {
      height: 100px;
    }

  }

}

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

Issue with displaying images in nanoGallery

I am currently in the process of developing a straightforward static website using Bootstrap 4 for an organization. One of the pages on this site is a Gallery page, and I am utilizing the JQuery library 'nanoGallery' to pull albums from Flickr. ...

Completed Animation with Callback in AngularJS CSS

Currently working with AngularJS and hoping to receive a notification upon completion of an animation. I am aware that this can be achieved with javascript animations such as myApp.animation(...), but I'm intrigued if there is an alternative method wi ...

Steps for ensuring a div component appears on top of any other component (like h1 or p)

The outcome of the code below is displayed in this image: https://i.stack.imgur.com/CPDqC.png Is it possible to make the dropdown overlap on top of the 'HELLO's text, hiding the h1 and p tags? I have tried using z-index without success. Making ...

How can I shift the button's location within a pop-up in Ionic 1?

enter image description here I am struggling to make the button green underneath the three other buttons. Can someone please assist me with this? Here is my code: $scope.showIntroductionPage = function(childs){ if(childs == 0){ var myPopup = $io ...

The radar chart created with amchart.js disappears when placed within bootstrap columns

I'm encountering an issue while trying to display radar charts using amchart.js in bootstrap columns. The "amStockGraph" charts render perfectly, however, the radar charts appear blank with no errors in the console. Any advice on this matter would be ...

Tips for utilizing Bootstrap 4 exclusively within a designated Bootstrap Modal

Currently, I am working on an application that utilizes Bootstrap 3. Unfortunately, the Bootstrap 3 files (.css/js) have undergone extensive modifications. My task involves integrating the SummerNote Text editor, and although everything is functioning corr ...

Tips for extracting designated link by employing a Selector CSS Query

Please note: While a similar question has been asked on JSoup:How to Parse a Specific Link, I have a more specific variation of this inquiry. Kindly read on for further details. In order to extract data from a particular site link, I am looking to utili ...

What is causing compatibility issues between Firefox and the provided CSS code?

I am experiencing an issue with the page layout in FireFox. The widths are not displaying correctly and the upload button does not work. However, I have no problems when using IE or Chrome. I have reviewed the code but cannot find any errors. Here is the ...

Issues with IE8 compatibility on the website

I'm in the process of developing a website and I'm facing some issues specifically with IE8 or later versions. For reference, here is a temporary link to the site: . 1 The problems I am encountering are as follows: The login/register form disp ...

Tips for removing the horizontal space between adjacent columns within a Bootstrap card

I have a unique card design that includes... https://i.sstatic.net/3p1Wo.png <div class="d-flex align-items-stretch col-6 col-sm-6 col-md-4 col-lg-4 col-xl-4 p-2 "> <!-- Custom Card Design --> <a href="https://www.example.com" clas ...

Tips for personalizing buddypress groups

Currently, I am in the process of setting up a WordPress page and want to customize the appearance of my BuddyPress groups. My goal is to have them displayed horizontally instead of vertically. Can anyone provide me with a step-by-step guide on how to ac ...

Utilize CSS to style active buttons with JavaScript

In an HTML document, the dynamic generation of divs and buttons using JavaScript can be seen in the code snippet below. <div style="background: rgb(247, 247, 247);"> <button class ="xyz" disabled="disabled">Button1</button> </div> ...

Achieving Vertical Centering of Text in Bootstrap 5 Buttons with Flex Box to Prevent Overlapping Icons

How can I prevent the text on a Bootstrap 5 button with horizontally and vertically centered text, along with a right aligned icon, from overlapping when it wraps? Additionally, how do I ensure that the icon stays vertically centered when the button text w ...

Utilize a CSS rule exclusively if the following div element is present - Purely CSS, no need

Can we apply a CSS rule only when a div follows another div? For example: <div class="div1">...</div> <div class="div2">..</div> CSS Example: (if div2 exists) .div2 .div1 (apply CSS rule to div1) { backgrou ...

Error loading CSS file on Google App Engine

I attempted to add a CSS file as a static file in my project just to experiment with how it functions, but encountered difficulties right from the start. The content of the CSS file is: body { background:#00FF00; } In addition, here is my configurat ...

Activate anchor classes in several anchor link menus simultaneously

I have a one-page website with multiple menus filled with anchor links. Here is an example of what they look like: <ul> <li><a href="#home" class="active" onclick="closeNav();">Home</a></li> <li><a href="#abo ...

Struggling to show labels in the correct position for each button?

I need help with aligning labels under buttons. I have 3 buttons, each with a corresponding label. I want the labels to be displayed in line under the buttons, and if the length of a label exceeds the button width, it should wrap to the next line. I'v ...

Is there a way to leverage the extensive Bootstrap 5 color palette within an Angular application?

Currently working on a project in Angular 12 with Bootstrap 5 and SCSS, I'm facing a challenge in utilizing the new extended Bootstrap 5 color palette such as indigo-300 or pink-200. I'm not sure if I need to import them in a certain way or how t ...

Div content with a unique angle

I need to create a website with slanted div elements that must meet the following criteria: The sections should have a height of approximately 400px when displayed side by side, and about 800px when they stack vertically. It would be ideal if this could ...

Tips for effectively utilizing the page-break property within CSS

I am faced with an issue on my HTML page where multiple angular material cards are being displayed: ... <mat-card class="mat-card-98"> <mat-card-header> <mat-card-title>THIS IS MY TITLE</mat-card-title> < ...