Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To center a div to page using flex layout - angular material 2

I want to make a card display in center to the page. When i put the class progress-wizard in a separate div like below.

<div class="progress-wizard" >
  <div fxLayout="row" fxLayoutAlign="center center">
    <mat-card>
      <button mat-raised-button color="primary">Primary</button>
    </mat-card>
  </div>
</div>

css:

.progress-wizard {
  height: 90vh!important;
}

In this way, second div not inheriting the parent div height and card is not aligned in center. i would like to know how flex layout works and correct solution for this?

Thanks.

like image 911
Mathan K A Avatar asked Oct 18 '25 15:10

Mathan K A


1 Answers

fxLayoutAlign for aligin vertically center and fxFill for getting 100% height.

<div class="class" fxLayout fxFill fxLayoutAlign="space-around center">
</div>
like image 138
Sajin M Aboobakkar Avatar answered Oct 20 '25 06:10

Sajin M Aboobakkar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!