更改角材料文本框的主要颜色

时间:2021-05-10 12:43:34

标签: css angular angular-material

我正在使用有角度的材料,我需要单独更改文本框的主要颜色。 有没有办法只对文本框进行更改

 <mat-form-field class="example-full-width">
    <mat-label>Favorite food</mat-label>
    <input matInput placeholder="Ex. Pizza" value="Sushi">
  </mat-form-field>

enter image description here

我想更改下划线颜色。

1 个答案:

答案 0 :(得分:0)

尝试在输入字段中添加一个类。

 <mat-form-field class="example-full-width">
    <mat-label>Favorite food</mat-label>
    <input class="fav-food-input" matInput placeholder="Ex. Pizza" value="Sushi">
  </mat-form-field>

在你的 css 文件中

.fav-food-input{
color: red !important; //Whichever color you need
}