Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change height of Mat-Card element in angular material design component

I have the following code in angular 5 app. which produces the sequence of mat-card as below image using *ngFor. But the height of all the mat-card is same as the height of first mat-card .

         <div fxLayout="row">
          <mat-card *ngFor="let section1 of sections" fxFlex="33" style="margin: 15px;">
               <mat-card-header>
                    <mat-card-title>{{section1}}</mat-card-title>
               </mat-card-header>
               <mat-card-content>
                    <form>
                      <!-----form data goes here ---->
                    </form>

               </mat-card-content>

         </mat-card>

      </div>

The result is list of mat card as below, but the problem is height of all mat-card is same as height of first mat card in the loop. Is there any way to make it dynamic based on the content it carries?

Mat-card with same height due to *ngFor

like image 398
Talk is Cheap Show me Code Avatar asked Mar 13 '18 06:03

Talk is Cheap Show me Code


1 Answers

Set fxFlexAlign="stretch" to have all mat-card in same height.

like image 188
Debattam Dey Avatar answered Oct 15 '22 14:10

Debattam Dey