簡體   English   中英

無法改變角度的材質選擇占位符顏色

[英]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;
}

這是Stackblitz的一個分支來演示

Try this

:host /deep/ .mat-form-field-label-wrapper .mat-form-field-label {
    color:white !important;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM