Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placeholder left margin/padding on Angular Material datepicker?

It's easy to set a left margin/padding on the Angular Material Datepicker value just adding padding-left: xx on the input's css:

Successs

But is it possible to add left margin to the datepicker's placeholder?

I would like to have a bigger margin so that the validation symbol does not hide the placeholder's text:

Error

like image 624
Iñigo Avatar asked Mar 22 '26 00:03

Iñigo


1 Answers

In order to add left margin to datepicker placeholder you need to add the following code in your css

<mat-form-field class="my-class">

::ng-deep .my-class .mat-form-field-label{
   padding-left: 20px;
}

Note: Without using ::ng-deep your padding left will not have any effect not even for 10 or 15px.

like image 95
Sudipto Mukherjee Avatar answered Mar 23 '26 15:03

Sudipto Mukherjee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!