问题描述
我正在尝试为残障人士更改mat-form-fields的背景颜色。经过一副好看,我不知道该怎么做。下面是我的相同代码:
HTML
<div class="col-md-4">
<mat-form-field appearance="outline">
<mat-label>Verified by</mat-label>
<input matInput formControlName="verby">
<mat-error>Hint</mat-error>
</mat-form-field>
</div>
TS
form = this.fb.group({
verby: [{value:'',disabled:true}]
});
在 style.css 中,我进行了如下更改:
.mat-form-field-appearance-outline:disabled .mat-form-field-outline:disabled {
background-color: gray;
}
但是这件事没有任何影响。任何人都可以提出建议吗?
解决方法
.mat-form-field{
background-color: gray;
}
例如,您也可以使用:: ng-deep强制css应用
::ng-deep.mat-form-field{
background-color: gray !important;
}
已更新 StackBlitz
.mat-input-element:disabled {
background-color: grey;
}