如何在 Angular 6 Material 中更改文本框占位符颜色 [英] How to change text box placeholder color in Angular 6 Material
本文介绍了如何在 Angular 6 Material 中更改文本框占位符颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Angular 6 材质代码.
<mat-form-field>
<input matInput placeholder="Input">
</mat-form-field>
我想在输入元素获得焦点时更改默认颜色.
I wanted to change default color when input element get focused.
我已经厌倦了这个.怎么做我在角材料中使用 css 更改 md-input-container 占位符颜色
似乎没有任何效果.
推荐答案
如果我理解你的问题,这个 css 应该可以工作.
If i understand your question this css should work.
.mat-focused .mat-form-field-label {
/*change color of label*/
color: red !important;
}
.mat-form-field-underline {
/*change color of underline*/
background-color: blue !important;
}
.mat-form-field-ripple {
/*change color of underline when focused*/
background-color: yellow !important;;
}
希望有用.
这篇关于如何在 Angular 6 Material 中更改文本框占位符颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文