如何更改有角度的轨道轮廓边框的大小?

问题描述

我使用棱角材料。聚焦时,我不知道如何更改边框的大小。我不希望看到厚度。

  <form class="example-form">
  <mat-form-field  appearance="outline" class="example-full-width">
    <input matInput placeholder="Email" [formControl]="emailFormControl">
    <mat-error *ngIf="emailFormControl.hasError('email') && !emailFormControl.hasError('required')">
      Please enter a valid email address
    </mat-error>
    <mat-error *ngIf="emailFormControl.hasError('required')">
      Email is <strong>required</strong>
    </mat-error>
  </mat-form-field>
</form>

解决方法

使用角材料非常棘手(至少在一开始)。理想的解决方案是创建适合您需求的自定义主题。您可以在此处检查操作方法:

https://material.angular.io/guide/theming

例如,如果您想快速修复,一种简单的方法是在CSS文件中使用::ng-deep,例如:

::ng-deep .material-class {
   border: none;
}

::ng-deep已过时,它将很快停止工作。您应该为您的应用程序真正创建一个特定的主题。