角度材料动态表的Nostyle更改

时间:2020-07-16 12:54:01

标签: angular

我使用了this角材料动态表。我想更改列宽,但无法更改该表中的任何样式。 Thisdemo page进行测试。我在CSS下面添加了用于测试是否有任何更改的

table, table td, table tr td, table th, .mat-cell, mdt-dynamic-table, mdt-dynamic-table table {
  background-color: red;
}

为什么该表没有任何样式?如何调整列宽的大小或更改任何样式?

1 个答案:

答案 0 :(得分:1)

看起来您的表不是要为其设置样式的组件的一部分。

您尝试使用::ng-deep吗?

https://angular.io/guide/component-styles

:host ::ng-deep table {
  background-color: red;
}