[英]can't change angular's material select placeholder color
我有问题在黑暗的背景上将占位符的颜色设置为白色,当设置为白色时,它有如下奇怪的笔划:
https://stackblitz.com/edit/angular-twbzew-ealbnk
<mat-form-field>
<mat-select [ngClass]="className" placeholder="{{someText}}">
<mat-option *ngFor="let item of items" [value]="item.value">
{{ item.viewValue }}
</mat-option>
</mat-select>
</mat-form-field>
.basic-container {
background: black;
padding: 5px;
}
.class1 .mat-select-placeholder {
color:white !important;
}
似乎第二个占位符元素位于前面。
您可以修改CSS以使第二个元素变为白色,如下所示:
.class1 .mat-select-placeholder,
.class1 + .mat-input-placeholder-wrapper .mat-input-placeholder {
color:white !important;
}
Try this
:host /deep/ .mat-form-field-label-wrapper .mat-form-field-label {
color:white !important;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.