简体   繁体   中英

Angular Material Input Floating Label Default Color Change

Can i change the floating default purple color of the lable?

 <mat-form-field>
 <input matInput placeholder="My Lable" formControlName="my-Lable">
</mat-form-field>

User color attribute of material theme: color="primary" or "accent" or "warn",for extra colors you can use custom themes,or override color in css file.

 <mat-form-field color="accent"> <------here
   <input matInput placeholder="My Lable" formControlName="my-Lable">
 </mat-form-field>

I prefer <mat-label></mat-label> than *placeholder*

<mat-form-field>
<mat-label>Agent Code</mat-label>
<input matInput>
</mat-form-field>

then you just call it in css

mat-label {
  color: blue;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM