Reputation: 43
I want to trim the material input placeholder message with ellipses but the css gets applied to the label instead.
I am able to apply the css successfully to the material input when mat-form-field appearance is set to standard and we don't have a label. But when it's set to outline, the css gets applied to label.
I have the following html and css code:
.myFormField {
display: block;
width: 100%;
.mat-form-field-infix {
.mat-input-element {
&:placeholder-shown,
&::placeholder {
text-overflow: ellipsis;
overflow: hidden;
}
}
}
}
<mat-form-field appearance="outline" class="myFormField">
<mat-label> Business Name lorem</mat-label>
<input matInput formControlName="name"
placeholder="Business Name lorem ipsumejshdskhdsahdkasdk hasdaskdahdkjhas" required>
</mat-form-field>
Upvotes: 0
Views: 1043