jQuery UI datepicker: How to color sundays red?

青春壹個敷衍的年華 提交于 2019-12-12 19:30:10

问题


i need sundays to highlight in red.

I know that there is a class called ui-datepicker-week-end.

My problem is, that the other classes (ui-widget-content and ui-state-default) overwrite the red color of ui-datepicker-week-end, even if set !important.

The only thing that is colored are the weekend days in the headline of the calendar.


回答1:


You can style the anchors that are descendants of the .ui-datepicker-week-end elements, and set their background-image property to none when adding the background color. This gives good results without you having to use !important:

.ui-datepicker-week-end a {
    background-image: none;
    background-color: red;
}

EDIT: If you want to set the color property instead of background-color, you will indeed have to use !important:

.ui-datepicker-week-end a {
    color: red !important;
}

You can see the results in this fiddle.




回答2:


Easy way

sunday color red this way

.datepicker table tr td:first-child {
color: red
}

monday color red this way

.datepicker table tr td:first-child +td {
color: red
}

thuesday color red this way

.datepicker table tr td:first-child + td + td {
color: red
}


来源:https://stackoverflow.com/questions/10294167/jquery-ui-datepicker-how-to-color-sundays-red

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!