0

I am relatively new to Angular and I couldn't find any solution to the following problem.

I have the following code:

    <mat-form-field>
        <input matInput placeholder="ZIP" style="color:red;">
    </mat-form-field>

I want it to write the word ZIP in red, but all it does is showing a red cursor, and the word zip is still grayed out. This works perfectly when working with input, and not with matInput.

Does anybody know how can it be solved?

Thanks!

David Walschots
  • 12,279
  • 5
  • 36
  • 59
Moshe Davidi
  • 83
  • 1
  • 5
  • 1
    https://stackoverflow.com/questions/2610497/change-an-html5-inputs-placeholder-color-with-css – imjared Feb 25 '18 at 16:14

1 Answers1

0

Try this way :

<mat-form-field class="example-full-width">
    <mat-label style="color: red">Zip</mat-label>
    <input matInput>
  </mat-form-field>

Live example : https://stackblitz.com/edit/angular-rkewwm?file=app/input-overview-example.html (Don't forget to upgrade your package @angular/material, v5 min if I'm not mistaken)

mickdev
  • 2,765
  • 11
  • 15