1

I've use mat-card, in that I've used mat-card-title, for that I've used style="text-align:center"; but it's not aligning center

<mat-card style="text-align: center;">
  <mat-card-header >
<mat-card-title style="text-align: center;">
  spreadsheet
</mat-card-title>
</mat-card-header>
      <mat-card-content>
    <div id="spreadsheet"></div>
  </mat-card-content>
</mat-card>

And this is the screenshot of the browser:

enter image description here

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Aashiq
  • 447
  • 1
  • 12
  • 27

2 Answers2

3

html file:

<mat-card class="title_center">
    <mat-card-title>spreadsheet</mat-card-title>
</mat-card>

css file:

.title_center {
  display: flex;
  justify-content: center; /* align horizontal */
  align-items: center; /* align vertical */
}
1

Text align not having effect because mat-header tag only having the width of its content. You can try like this

<mat-card >
  <div style="text-align:center;">
    <mat-card-title>spreadsheet</mat-card-title>
  </div>
  <mat-card-content>
<div id="spreadsheet">
</div>

Siva Rm K
  • 284
  • 1
  • 6