I have a mat-form-field
in my Angular project in which I need to add letter-spacing to the input value but not the input placeholder.
Currently, my input looks like this:
And when user types something in the input, it looks like this:
What I want, is for the input placeholder to look like this (without any letter spacing), but keep input value's letter spacing at the same time:
Is there any possible way to do this?
This is my HTML
:
<mat-form-field
id="mobileNumber"
appearance="outline"
>
<span matSuffix>+98</span>
<input
type="text"
matInput
name="mobileNumber"
formControlName="mobileNumber"
placeholder="Mobile Number"
/>
</mat-form-field>
And this is my SCSS
:
mat-form-field#mobileNumber {
width: 70%;
::ng-deep .mat-form-field-wrapper,
.mat-form-field-wrapper {
::ng-deep .mat-form-field-infix {
direction: ltr;
text-align: center;
::ng-deep input {
letter-spacing: 8px;
}
}
}
}
::placeholder /* Chrome, Firefox, Opera, Safari 10.1+ */
:-ms-input-placeholder /* Internet Explorer 10-11 */
::-ms-input-placeholder /* Microsoft Edge */
With this, you can style the placeholder