【问题标题】:how to change placeholder color in mat-select in angular 8如何在角度8中更改mat-select中的占位符颜色
【发布时间】:2019-08-26 16:47:46
【问题描述】:

我正在尝试在其mat-focussed 之后更改我的选择框的占位符颜色和背景颜色,但颜色或背景没有改变。它被固定为相同的蓝色原色。

<mat-form-field floatLabel="never">
         <mat-select  placeholder="Select Function">
           <mat-option *ngFor="let option of functionOptions" [value]="option.name">
                    {{option.name}}
           </mat-option>
         </mat-select>
       </mat-form-field>

scss

::ng-deep .mat-form-field.mat-focused .mat-form-field-label {
   color: #4dff91!important;
   background-color : grey;
}

我什至尝试将占位符更改为 mat-label 并为 mat-label 提供 css,但仍然没有运气

【问题讨论】:

    标签: angular-material angular8


    【解决方案1】:

    试试不带 ::ng-deep 的 css

    .mat-form-field.mat-focused .mat-form-field-label {
       color: #4dff91 !important;
       background-color : grey;
    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-15
      • 1970-01-01
      • 2019-02-21
      • 1970-01-01
      • 2019-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多