我正在尝试自定义 Angular Material mat-form-field :
我能够使用以下方法自定义下划线边框:
::ng-deep.mat-form-field-ripple {
background-color: yellow;
}
现在我正在尝试将禁用状态下的下划线边框自定义为实线而不是虚线:
我试过这个,但它对下划线不起作用:
::ng-deep.mat-form-field-disabled
{
}
我希望它在禁用状态下呈灰色实心
<mat-form-field>
<input matInput placeholder="Input" [disabled]='true'>
</mat-form-field>
最佳答案
这修复了它:
::ng-deep.mat-form-field-disabled .mat-form-field-underline
{
background-image: linear-gradient( to right, rgba(0, 0, 0, 1) 0, rgba(0, 0, 0, 0.42) 33%, #c2c7cc 0 ) !important;
background-size: 1px 100% !important;
background-repeat: repeat-x !important;
}
关于angular - 如何自定义处于禁用状态的 mat-form-field,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54355907/