Changing border color in mat-form-field
Add this CSS to your form-field-appearance-example.css:
/* Border */
.mat-form-field-appearance-outline .mat-form-field-outline {
color: white;
}
/* Font color */
input.mat-input-element {
color: white;
}
Though, there is still a problem while the field is focused.
How to set the focused border line color for mat-form-field
If you want to change this color strategy for all controls then you should visit https://material.angular.io/guide/theming. You can also make custom theme with your own colors.
In case you want for a specific control, you can do with below css
.mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick {
color: red;
}
Changing Angular Mat Input Border Bottom Color
I got the answer for this .
We should add the styles in the global styles.scss file to override the changes of mat input field styles .
I placed this in styles.scss and it worked -
.mat-form-field-appearance-outline .mat-form-field-outline { color: black; }
How to add border color in Mat Input Field in Angular
Please write this css at the end of style.css file
if you have added this css on Component.css then it will not work
if it still not works then try with !important
hope it will usefull for all
Reason
any css file or scss will apply last value of that styles
EXAMPLE
.CLASS {
font-size : 20px;
}
.CLASS {
font-size : 10px;
}
So it will encounter font-size : 10px;
Change (Increase) Border Radius of Mat-Form-Field
You need to increase the min-width of the left outline and apply border radius to only the left or right side.
::ng-deep .mat-form-field-outline-start {
border-radius: 28px 0 0 28px !important;
min-width: 28px !important;
}
::ng-deep .mat-form-field-outline-end {
border-radius: 0 28px 28px 0 !important;
}
https://stackblitz.com/edit/angular-9-material-starter-flnoeq?file=src/app/app.component.css
Related Topics
Pass Function or Mixin by Reference in SASS
How to Use/Emulate Regex-Like Backreferences in Attribute Selectors
Css: Transform: Translate(-50%, -50%) Makes Texts Blurry
Tint Image Using CSS Without Overlay
How to Horizontally Center a Floating Element of a Variable Width
Issue When Centering Vertically with Flexbox When Heights Are Unknown
Single VS Multiple Stylesheets in Responsive Web Design
CSS Grid Auto Fit with Max-Content
Chrome Issue with Background-Attachment Fixed and Position Fixed Elements
Label on the Left Side Instead Above an Input Field
How to Ensure That Text Is Inside Rounded Div
Looping Animation of Text Color Change Using CSS3
How to Evenly Distribute Elements in a Div Next to Each Other