我正在尝试自定义角材的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>
答案 0 :(得分:1)
此问题已解决:
::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;
}
答案 1 :(得分:0)
您需要定位以下课程:-
.mat-form-field-disabled .mat-form-field-underline
您要更改的CSS是:-
background-image: linear-gradient(to right,rgba(0,0,0,1) 0,rgba(0,0,0,.42) 33%,transparent 0);
background-size: 4px 100%;
background-repeat: repeat-x;
因此,您可以unset: all
重新开始,或者更新background-size: 1px 100%;
或任何适合您的需求
答案 2 :(得分:0)
此问题已解决:
::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;
}
答案 3 :(得分:0)
你可以试试
::ng-deep .mat-form-field-disabled {
.mat-input-element {
color: rgba(0, 0, 0, 0.14);
}
.mat-form-field-label {
color: rgba(0, 0, 0, 0.14);
}
.mat-form-field-underline {
color: rgba(0, 0, 0, 0.14);
}
.mat-form-field-ripple {
color: rgba(0, 0, 0, 0.14);
}
.mat-form-field-required-marker {
color: rgba(0, 0, 0, 0.14);
}