我希望输入中所需的“*”颜色为红色。 为此,我导入并使用 react 形式和 Angular Material 。还没有 CSS,因为我不知道如何使用输入中所需的元素来编辑它。
<form (ngSubmit)="changePassword()">
<mat-form-field floatLabel="always">
<input required type="password" matInput placeholder="Old password">
</mat-form-field>
最佳答案
CSS 选择器是
.mat-placeholder-required.mat-form-field-required-marker {
color: red;
}
请务必创建 deep styling如果您在组件中设置它的样式,或者放入全局样式文件,例如 style.css
(就像我所做的那样)
关于ANGULAR:如何更改 Material 中所需的*?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58282490/