![](/img/trans.png)
[英]How do I change md-input-container placeholder color using css in angular material?
[英]how to change the color of md-input-container placeholder when focus?
我正在使用angular 4,並且有一個帶有占位符的md-input-container。 當我在輸入中鍵入內容時,占位符顯示為標簽。 在這種情況下如何更改占位符的顏色?
<md-input-container class="mb-1 data_font">
<input mdInput placeholder="Full name">
</md-input-container>
我通常將mat-form-field
用作input
字段的包裝。
<mat-form-field class="mb-1 data_font">
<input mdInput placeholder="Full name">
</mat-form-field>
現在,您可以將以下代碼添加到CSS中:
.mat-focused .mat-form-field-label {
color: red;
}
請記住,如果要總體上更改調色板,則應考慮使用以下主題: https : //material.angular.io/guide/theming
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.