【问题标题】:How to change mat-checkbox background-color in CSS3 ? Angular6如何在 CSS3 中更改 mat-checkbox 背景颜色?角6
【发布时间】:2018-09-19 16:45:14
【问题描述】:

我需要使用 mat-ripple 更改背景 class="matCheckboxClass"

HTML:

<mat-checkbox class="matCheckboxClass"></mat-checkbox>

CSS3:

.matCheckboxClass .mat-checkbox-checked
.mat-accent.mat-checkbox-background, .mat-checkbox-indeterminate.mat-accent 
.mat-checkbox-background {
background-color: rgb(27, 142, 241) !important;
}

.matCheckboxClass .mat-ripple-element  {
 background: rgba(27, 142, 241, .4) !important;
 }

注意:::ng-deep 将更改所有 mat-checkbox 我需要更改特定的 mat-checkbox。

【问题讨论】:

    标签: css angular-material angular6


    【解决方案1】:
    you can try this:
    
    :host /deep/{
        .matCheckboxClass .mat-checkbox-checked
        .mat-accent.mat-checkbox-background, .mat-checkbox-indeterminate.mat-accent 
        .mat-checkbox-background {
        background-color: rgb(27, 142, 241) !important;
    }
    
     .matCheckboxClass .mat-ripple-element  {
         background: rgba(27, 142, 241, .4) !important;
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-11-18
      • 1970-01-01
      • 2021-01-02
      • 1970-01-01
      • 2015-05-23
      • 2019-06-26
      • 1970-01-01
      • 1970-01-01
      • 2020-11-26
      相关资源
      最近更新 更多