0

I created an outline textbox:

<mat-form-field appearance="outline">
    <input matInput placeholder="Username">
  </mat-form-field>

I am trying to control the height, the border color using:

.mat-form-field {
  height:20px;
  border:1px solid #f0f;
}

But the result is far from the desired. Is there a way it can be done? Sample code I created on stackblitz https://stackblitz.com/edit/angular-material-custom-input-j3k2h

0

1 Answer 1

3

You can add this style to edit height:

.mat-form-field-infix {padding:0 !important; border:0 !important;}
.mat-form-field-flex{ margin:0 !important; padding:5px !important; padding-bottom: 17px !important; height: 20px !important;}
.mat-form-field-wrapper { padding: 0 !important; }

And this one to edit the border-color:

.mat-form-field-appearance-outline .mat-form-field-outline {
  color: #f0f;
}
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, the border color works, but the height still remains the same
That is working. Placing the input up to top border, but that is manageable. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.