【问题标题】:Can't center column header for a sortable column in a mat-table无法将垫表中可排序列的列标题居中
【发布时间】:2019-12-20 09:48:05
【问题描述】:

我有一个带有可排序列的 mat-table,例如 this,但我无法将我的 css 文件中的列标题居中。我可以在浏览器调试器中完成!

我在下面的 css 文件中尝试了这个,但没有成功,但是当我在调试器中修改它时它可以工作。

.mat-sort-header-container {
   justify-content: center !important;
 }

任何帮助将不胜感激!

【问题讨论】:

  • prnt.sc/qdbzaw th.mat-header-cell { text-align: center; } 你想要这样吗?
  • 试过了,也不行
  • 我也在寻找这个问题的答案。

标签: html css angular-material mat-table


【解决方案1】:

试试这个

th.mat-header-cell {
    text-align: center !important;
}

【讨论】:

  • 看起来 mat-table 在渲染时覆盖了我的 css。但不确定
猜你喜欢
  • 2018-04-13
  • 2017-12-09
  • 2011-07-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-02-05
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多