首页 > 解决方案 > Angular Material Dynamic Table 的 Nostyle 已更改

问题描述

我使用了这个角度材料动态表。我想更改列宽,但我无法更改该表中的任何样式。是用于测试的演示页面。我在 CSS 下面添加了测试是否有任何变化:

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

为什么任何样式都不适用于该表?如何调整列宽或更改任何样式?

标签: angular

解决方案


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

你试过::ng-deep吗?

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

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

推荐阅读