css 如何将角形垫扩展面板居中?

qoefvg9y  于 2023-02-10  发布在  其他
关注(0)|答案(2)|浏览(103)

我已经尝试了我能想到的一切来让这个工作。我修改了一个不同的stackblitz来添加这个作为测试:
https://stackblitz.com/edit/angular-acdxje-8bz7tq?file=app%2Ftable-basic-example.html,app%2Ftable-basic-example.css,styles.css,app%2Ftable-basic-example.ts
我正在使用的代码:

<mat-expansion-panel [expanded]="Expand" style="width: 80%; text-align: center">
  <mat-expansion-panel-header>
    <mat-panel-title style="text-align: center"> Test </mat-panel-title>
  </mat-expansion-panel-header>
</mat-expansion-panel>

任何帮助将不胜感激!

5t7ly7z5

5t7ly7z51#

text-align: center替换为margin: 0 auto

sy5wg1nm

sy5wg1nm2#

我只是快速检查了代码,发现头文件使用了flex

mat-expansion-panel-header .mat-content {
  justify-content: center;
}

相关问题