gpt4 book ai didi

css - 更改禁用 Material 填充输入的背景

转载 作者:太空宇宙 更新时间:2023-11-04 05:47:42 25 4
gpt4 key购买 nike

使用 Angular Material 我可以改变这个 fill-matInput 的背景:

<mat-form-field>
<mat-label>Tax-number</mat-label>
<input type="text" matInput [id]="'taxnumber'" [formControl]="controlContainer.control.controls['taxnumber']">
<mat-error>{{controlContainer.control.controls['taxnumber'].errors | bsErrorMessage}}</mat-error>
</mat-form-field>

我可以使用以下 css 更改背景:

.mat-form-field-appearance-fill
.mat-form-field-flex {
background: rgba(255, 255, 255, 1);
}

现在我想在禁用时更改控件的背景。我最好的猜测是

.mat-form-field-appearance-fill:disabled
.mat-form-field-flex:disabled {
background: rgba(255, 15, 15, 1);
}

但这行不通。那么我该如何更改禁用的 Angular Material 填充输入的背景呢?

我为这个问题创建了一个 stackblitz: https://stackblitz.com/edit/angular-bcqsjo

最佳答案

查看您的 stackblitz 链接 我刚刚打开 chrome 开发工具并检查了禁用字段。这是正在应用的 css:

.mat-form-field-appearance-fill.mat-form-field-disabled .mat-form-field-flex {
background-color: rgba(0,0,0,.02);
}

所以父级上多了一个类(mat-form-field-disabled)。您更新后的代码将是:

.mat-form-field-appearance-fill.mat-form-field-disabled .mat-form-field-flex {
background: rgba(255, 255, 255, 1);
}

关于css - 更改禁用 Material 填充输入的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58571890/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com