我想要修改 Angular Material 输入框的占位符文字颜色。默认情况下是黑色,但是由于背景颜色为深色,所以我希望它是白色。
我已经阅读了这个站点上所有相关的帖子,但是似乎没有任何方法可以做到这一点。 ::ng-deep 和 mat-placeholder 都不可行。
这是我的 HTML 片段:
<form #searchForm="ngForm" class="example-full-width mr-auto">
<mat-form-field style="width: 350px; font-size: 14px; margin-bottom: -15px;">
<mat-label style="color: white;">Search for an Employee</mat-label>
<input matInput [(ngModel)]="userIdInput" placeholder="Enter at least 2 characters of a name or ID"
!important
的设置正在覆盖它?实际标签是某个具有自己样式的子元素吗? - krillgarmat-form-field-label
。 - wentjun