Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display two mat-card at the same row

Tags:

angular5

i have unknown number of card i want to ngfor on them and display every two card in one row

<mat-card class="example-card">
  <mat-card-header>
    <div mat-card-avatar class="example-header-image"></div>
    <mat-card-title>{{user.firstName}}</mat-card-title>
    <mat-card-subtitle>{{user.lastName}}</mat-card-subtitle>
  </mat-card-header>
  <mat-card-content>
    <p>
      The Shiba Inu is the smallest of the six original and distinct spitz breeds of dog from Japan.
      A small, agile dog that copes very well with mountainous terrain, the Shiba Inu was originally
      bred for hunting.
    </p>
  </mat-card-content>
  <mat-card-actions>

  </mat-card-actions>
</mat-card>

i'm using angular 5 and material design 6 is there anyway to do that ?

like image 454
abdalrahman makahleh Avatar asked Oct 17 '25 04:10

abdalrahman makahleh


1 Answers

Spent hours on this... turned out to be trivial: simply add float:left to your class CSS. In my case it looked like this:

.example-card {
    max-width: 300px;
    margin-bottom: 50px;
    float: left;
}
like image 171
Tetyana Savenko Avatar answered Oct 28 '25 14:10

Tetyana Savenko