【发布时间】:2020-08-06 09:23:45
【问题描述】:
我在一页上有 mat-form-field:-
<mat-form-field class="form-control-full-width">
<input type="text" matInput placeholder="First Name" formControlName="firstNameFC" required>
<mat-error *ngIf="hasNewUserError('firstNameFC', 'required') && isNewUserSubmitted">
First Name is required
</mat-error>
</mat-form-field>
以下 CSS 应用:-
.mat-form-field-label {
/*change color of label*/
color: white !important;
}
.mat-form-field-underline {
/*change color of underline*/
background-color: white !important;
}
.mat-form-field-ripple {
/*change color of underline when focused*/
background-color: white !important;;
}
.mat-input-element{
color: white !important;
}
CSS 正在按预期进行反射。
问题是我在不同的页面上有另一个 mat-form-field 并且想在该字段上应用不同的 CSS(颜色:绿色,背景颜色:白色)。
是否可以在不同页面的控件上应用不同的 CSS?
【问题讨论】:
标签: html css angular angular-material mat-form-field