繁体   English   中英

焦点时如何更改md-input-container占位符的颜色?

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM