提问人:New_Angular Developer 提问时间:8/31/2023 更新时间:8/31/2023 访问量:150
垫子形状场轮廓颜色和尺寸变化
Mat-form-field outline color and size change
问:
我在 Angular 16 中有一个带有日期范围选择器的 mat-form-field.I 尝试更改输入的颜色和大小,但很难。谁能帮忙? 这是我的代码:
<div class="datePicker">
<mat-form-field appearance="outline">
<mat-date-range-input [rangePicker]="picker">
<input matStartDate placeholder="Start date">
<input matEndDate placeholder="End date">
</mat-date-range-input>
<mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
<mat-date-range-picker #picker></mat-date-range-picker>
</mat-form-field>
</div>
.mat-form-field-outline {
height: 30px;
}
.mat-form-field-appearance-outline .mat-form-field-outline {
color: gray;
}
.mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick {
color: gray;
}
.mat-form-field-appearance-outline .mat-form-field-infix {
padding: 0em 0 0em 0;
}
答:
0赞
Myles Morrone
8/31/2023
#1
要访问/覆盖提供的 css 材料,您必须使用 ::ng-deep。前任:
::ng-deep .mat-form-field-appearance-outline .mat-form-field-infix {
padding: 0em 0 0em 0;
}
这并不是真正推荐的解决问题的方法,但它通常非常有效。如果有任何东西使用 s,那么您可以使用 访问 shadow-dom 选择器。part
div::part(partName)
评论