angular - 如何在Angular Material 中为文本输入着色

标签 angular angular-material

这是我的用户表单:

enter image description here

我有一个问题,输入字段的颜色是白色的,背景也是白色的。
我找不到任何地方如何更改输入字段的颜色。

颜色 texte 的 css 属性是什么?

这是我的模板:

<div class="example-container" style="color:red">
    <mat-form-field>
      <input matInput placeholder="Input">
    </mat-form-field>

    <mat-form-field>
      <textarea matInput placeholder="Textarea"></textarea>
    </mat-form-field>

    <mat-form-field>
      <mat-select placeholder="Select">
        <mat-option value="option">Option</mat-option>
      </mat-select>
    </mat-form-field>
  </div>
  new contact

最佳答案

Here is some most common properties of angular material v7

/* input color class */
::ng-deep input.mat-input-element {
  color: #484a4c;
}

/* Change label color on focused */
::ng-deep .mat-form-field.mat-focused .mat-form-field-label {
  color: #50d0fb !important;
}

/* underline border color on focused */
::ng-deep .mat-focused .mat-form-field-underline .mat-form-field-ripple{
  background-color: #50d0fb !important;
}

关于angular - 如何在Angular Material 中为文本输入着色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50604345/

相关文章:

md-toolbar 的 CSS 媒体查询

typescript - 如何迭代 Angular 2 ng-content 项目?

angular - 如何在 Angular 模板中迭代字典?

angularjs - 在 ng-repeat 中找不到 md-sidenav 句柄的实例

angular - 为 Angular Material Table 创建可重用组件并更改其表标题

css - 检索元素样式表中的原色

angular-material-extensions/select-country - 无法获取资源

html - 如何在 doc.fromhtml() jspdf 中包含 Angular 组件?

angular - Chrome 8 中的 Identity Server 4 和 SameSite cookie 问题

javascript - Angular 2 : What is an @Input/@Output alias?