【问题标题】:change the primary color for angular material text box更改角材料文本框的原色
【发布时间】:2021-05-12 02:49:50
【问题描述】:

我使用的是角材质,我需要单独更改文本框的原色。 有什么办法只针对文本框进行更改

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

我想改变下划线颜色。

【问题讨论】:

  • 你能加一点代码吗?还是代码sn-p??不能建议任何没有代码或 sn-p 的东西!

标签: css angular angular-material


【解决方案1】:

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

 <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
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-09-14
    • 2018-05-11
    • 2021-02-09
    • 2016-05-04
    • 1970-01-01
    • 2019-07-01
    • 2020-01-15
    • 2021-09-19
    相关资源
    最近更新 更多