Kalpa D. Fernando
Kalpa D. Fernando

Reputation: 157

How to change the size of mat-card in angular material

Screenshot

I want both Components the same height (the size of left form) tried margin , padding nothing works

below is the code for its parent element HTML

<mat-tab label="Update Profile">

    <div class="container">
      <mat-card class="mat-card-container">
      <div class="vertical-center row" >

        <div class="col-lg-1">
        </div>

        <div class="col-lg-6">
          <app-register [user]="user"></app-register>
        </div>

        <div class="col-lg-4 password-change-form">
          <app-password-change [id]="user.id"></app-password-change>
        </div>



        <div class="col-lg-1">
        </div>

      </div>
      </mat-card>
    </div>
  </mat-tab>

CSS

.vertical-center {
  margin-top: 2rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
}
.password-change-form{
  padding: inherit;
}
.spacer{}

Upvotes: 7

Views: 20092

Answers (2)

Kavinda Senarathne
Kavinda Senarathne

Reputation: 2004

Better you can use flex layout. Refer: [https://github.com/angular/flex-layout/wiki/fxLayoutAlign-API][1]

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

Upvotes: 3

Skywolfmo
Skywolfmo

Reputation: 44

The problem is not with the mat card, but with the div with password-change-form if you were asking to make them the same height:

.password-change-form{
   height:100%
}

but if you want them to have the same width, you should probably add col-lg-5 to both of them instead of 6 and 4

    <div class="col-lg-5">
      <app-register [user]="user"></app-register>
    </div>

    <div class="col-lg-5 password-change-form">
      <app-password-change [id]="user.id"></app-password-change>
    </div>

Upvotes: 1

Related Questions