3

您好我正在尝试自定义p-calendar但无法弄清楚如何更改正在显示的日期的颜色。请帮忙。提前致谢。

这是我的模板:

<div class="p-field p-col-12 p-md-4">
    <label for="time">Time</label>
    <p-calendar [(ngModel)]="date7" [showTime]="true" [inline]="true" inputId="time"></p-calendar>

</div>

我的CSS:

  ::ng-deep .ui-datepicker .ui-datepicker-group {
     background-color: whitesmoke;
 }

  
  ::ng-deep .ui-datepicker .ui-widget-content {
     border: 1px solid #888888;
     font-weight: normal;
     color: #000000;
     background-color: red

 }
4

1 回答 1

2

使用.p-datepicker代替.ui-datepicker

CSS

::ng-deep .p-datepicker table td > span {
  background-color: orange;
}

::ng-deep .p-datepicker table td.p-datepicker-today > span {
  background-color: burlywood;
}

演示

于 2020-11-10T11:52:34.187 回答