首页 > 解决方案 > CSS 覆盖 - MAT-TABLE - Angular Material 11

问题描述

我正在尝试根据我的视觉设计更改 MAT-TABLE。为此,我将覆盖材料的 css,如下所示。现在我可以按照 VD 看到我的桌子了。但我不知道这是覆盖材料 css 的正确方法。

会有什么影响?

影响意味着 -:host ::ng-deep它会影响我的应用程序中的任何其他 CSS 吗?

我要继续这样吗?或者这是覆盖CSS的任何干净方式。但是通过这样做,只有 mat-table 会采用这些更改。顺便说一句,我的 mat-table 是可重复使用的组件。

.mat-paginator,
:host ::ng-deep.mat-form-field-infix {
    background-color: #EDF2F7;
}

:host ::ng-deep.mat-paginator .mat-paginator-container,
:host ::ng-deep.mat-paginator-navigation-previous,
:host ::ng-deep.mat-paginator-navigation-next,
:host ::ng-deep.mat-select-value,
:host ::ng-deep.mat-select-arrow {
    color: #626C7A !important;
}

标签: cssangularangular-material

解决方案


推荐阅读