Is there a way to arrange three of these cards side by side using CSS to alter their layout?

Hey everyone, I currently have a page that looks like this:

Check out the current page

I'm looking to change it so that instead of one image per row, there are three images per row (and reduce their size to fit three in a row).

Here is my current code:

<mat-step [stepControl]="secondFormGroup" label="Selecciona Habitación">

  <div class="container"  *ngFor = 'let dummy of ListaPiezasView$ | async'>
    <!--Make any necessary modifications here-->
    <div class="card">
      <div class="container-fliud">
        <div class="wrapper row">
          <div class="preview col-md-4">
            
            <div class="preview-pic tab-content">
              <div class="tab-pane active" id="pic-1"><img src="{{dummy.foto}}" /></div>
              
            </div>
          </div>
      
          <div class="details col-md-8">
            <h3 class="product-title">{{dummy.codhabitacion__nombre}}</h3>
            <div class="rating">
              <div class="stars">
                <span><mat-icon class="estrella">star</mat-icon></span>
                <span><mat-icon class="estrella">star</mat-icon></span>
                <span><mat-icon class="estrella">star</mat-icon></span>
                <span><mat-icon class="estrella">star</mat-icon></span>
                <span><mat-icon class="estrella">star</mat-icon></span>
              </div>
              <h4 class="verde"><strong>Available</strong></h4>
            </div>
            <h4 class="price">{{dummy.accesorios}}</h4>
            <h4 class="price accesorioss">Price: <span>{{dummy.precio}}</span></h4>
            <h4 class="price"><strong>Quantity:</strong> {{dummy.cantidad}} </h4>
            <h4 class="price">Size:<span data-toggle="tooltip" title="small">{{dummy.tipocama}}</span></h4>
            <h4 class="price"><strong>Room Number:</strong> {{dummy.numero}} </h4>
            <br>
            <input formControlName= dias>
            <div class="action">
              <mat-radio-group name="opList" formControlName="secondCtrl" required>
                <mat-radio-button  class="selecthabitacion price" (click)="recibirPieza(dummy);" value="1" >Select Room</mat-radio-button>
            </mat-radio-group> 
 
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>




<div>
  <button mat-button  matStepperPrevious>Back</button>
  <button mat-button (click)="openSnackBar('You must select a room!', 'Understood', 'red-snackbar')" matStepperNext>Next</button>
  <div #btnRef></div>
</div>

<!--You can make changes up to this point-->

If you want to display three images per row and reduce their size, try modifying the code as suggested. Let me know if you need further assistance!

UPDATE:

This is what I achieved with the modified code provided by @AmeRiza

Although the images are smaller, the cards do not utilize the full space and appear too narrow.

The original card looked like this, but I am aiming for three cards in a row with decently sized images.

Here is the card before the changes were made

Answer №1

To improve your code, make sure to create a container element with the "row" class and inside it, use the "col-4" class for each item in the list using the "ngFor" directive.

<div class="container">
  <div class="row">
    <div class="col-4" *ngFor='let item of itemList$ | async'>
      <div class="card">
        <!-- your card content here -->
      </div>
    </div>
  </div>
</div>

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

When I press the button, a model popup will display the complete information

How can I display full information on a model popup when clicking a button? <button type="button" class="btn btn-primary btn-xs" data-toggle="modal" data-target="#myModal" > <i class="glyphicon glyphicon-zoom-in"></i> </button>< ...

What is the best way to integrate data-bs-toggle into my code?

I am currently exploring the use of data-bs-toggle with Bootstrap, but as a newcomer to the framework, I might be missing something essential in my setup. When attempting to implement data-bs-toggle, I notice that my autocomplete suggestions only include d ...

Creating a FusionCharts time series with a sleek transparent background

Currently, I am attempting to achieve a transparent background for a time-series chart created with FusionCharts. Despite trying the standard attributes that usually work on other chart types and even hardcoding a background color, none of these seem to af ...

The scroll bar disappears behind the div

Hello, I am looking to create an HTML layout similar to the one shown below: +----------------------+-----+ | upSide | | |----------------------| | | |right| | |side | | ...

Implementing a distinct approach to adding margins to div boxes using

Hello, I've been experimenting with the developer tools in Google Chrome to add margins to my navigation bar. The goal is to create gaps between the boxes. Any assistance would be greatly appreciated! http://jsfiddle.net/3jp1d0fe/8/ CSS div.contain ...

When the mouse hovers over, alter the background color with React

Currently attempting to adjust the background color of a Grid section when the mouse enters. I've made some progress, but now I seem to be stuck. My current approach involves calling a function to update the background color on mouse enter. const [isS ...

I Tried Adding Up All the Numbers, but It Doesn't Seem to Work for Every Dynamic Total Field

In my project, I am utilizing Laravel 5.7 and VueJs 2.5.*. The issue I am facing is that when I input values, the Total field calculates correctly. However, when I dynamically add rows for items, the calculation only works for the first row and not for the ...

Modify the class of rows in table 2 once a particular value of a radio button in table 1 has been selected

One issue I am facing is related to two tables with radio buttons. Each table highlights the corresponding row when a radio button is checked, working independently. However, I need a specific value from table 1 to un-highlight any previously checked rows ...

Tips for effectively removing objects from a PixiJS application

I have embarked on a game development project using Pixi.js that involves items falling from the top of the canvas. The functionality I've implemented so far allows items to spawn and move down the canvas until they reach the end of the window, at whi ...

Ways to adjust the border color when error helper text is displayed on a TextField

I am currently working with React Material UI's TextField element. What I aim to achieve is when the submit button is pressed, the helpertext displayed should be "Please enter the password." It should look like this: https://i.sstatic.net/Nu0ua.png ...

Troubleshooting Variances in CSS Layouts on Different Devices

I have been wrestling with a challenging question regarding CSS layouts, and I believe it's time to seek advice from those who may be more knowledgeable in this area. Let's discuss why my current layout is presenting such a headache. Take a look ...

Is there a way to control the visibility of two divs depending on which one a user hovers on?

Having two stacked div elements containing images, I want the div with id = "features3_HDS_image" to become visible when a user hovers over the div with id = "HDS_Blurb", and the div with id = "features3_FH_image" to be displayed when hovering over the div ...

Access the HTML file from a different directory

I have a directory called "myWebsite". Within this directory, there is a file named "index.html" and another subdirectory named "other". Inside the "other" directory, there are CSS files, JS files, and "page2.ht ...

What is the best way to locate an element with the class name being an email address using jQuery?

Is it possible to locate an element with an email address as the class name, considering that the email address varies? $(document).ready(function(){ //not working getting error var email="<a href="/cdn-cgi/l/email-protection" class="__cf_email__ ...

scraping information using xpath from the subsequent page

I've been attempting to extract data from a webpage located at , focusing on fund number 26. While I have no trouble retrieving information from the first page (funds number 1-25), I'm facing difficulties with scraping anything from the second p ...

What is the best way to iterate over each character in a string and trigger a function in JavaScript?

I am currently working on a project to create a random password generator. The code responsible for generating the password is functioning correctly. However, I am facing an issue with converting the characters of the password into phonetic equivalents. I ...

Ways to ensure the bootstrap table header width aligns perfectly with the body width

I am having an issue with my bootstrap table where the header width is smaller than the body width because I set the table width to auto. How can I align the header and body widths? Here is a link to a plunker showcasing the problem. https://plnkr.co/edit ...

PHP login system that retrieves information from a selected database

Currently, I am in the process of creating a login system using PHP, but I have encountered an error: Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/a9356103/public_html/login.php on line 13 The code sni ...

Aligning items vertically within a container with a constant height

I'm currently working on a website that requires a pixel-based navbar with a height of 80px. The issue I'm facing is the difficulty in vertically centering the ul and li elements. I have experimented with various methods such as using top:50%; ...

Error message indicating that the event "OnkeyDown" is not in sync within the React application

Hey everyone! I'm a beginner in web development and I'm struggling to understand why the event "OnKeyDown" is triggered the second time. My task involves changing (increasing, decreasing) parts of a date (day, month, year, hour, minutes, seconds) ...