【发布时间】:2021-02-28 01:02:08
【问题描述】:
我在标准 mat-form-field 中有一个标准 matInput 字段,该字段位于标准 [formGroup] div 中。父区域的背景是深色的,输入的默认颜色是深色的。那效果不好。这是 HTML 的示例..
<div [formGroup]="myInfo">
Year:
<mat-form-field>
<input class="myClass" style="color: white" matInput (keypress)="numericOnly($event)" placeholder='YYYY'
formControlName="yearControl">
</mat-form-field>
</div>
在线查看并根据此处的答案,我了解如何更改 .scss 中的内容,例如:
.childClass {
input { color: #fff !important; }
label.mat-input-placeholder { color: #fff !important; }
::ng-deep .mat-form-field-label { color: #fff !important; }
::ng-deep .mat-form-field-ripple { color: #fff !important; }
::ng-deep .mat-form-field-underline { color: #fff !important; }
}
这终于把占位符文字改了,输入的文字是白色的,但是下划线还是黑色的。感谢您一直以来的建议。
【问题讨论】:
标签: css angular colors mat-input