jQuery UI datepicker:如何将星期日变成红色?

我需要星期天以红色突出显示。

我知道有一个名为ui-datepicker-week-end

我的问题是,其他类( ui-widget-contentui-state-default )会覆盖ui-datepicker-week-end的红色,即使设置为!important

唯一有色的是日历标题中的周末日。

您可以设置作为.ui-datepicker-week-end元素的后代的锚点的样式,并在添加背景颜色时将其background-image属性设置为none 。 无需使用即可获得良好的效果!important

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

编辑:如果你想设置color属性而不是background-color ,你将确实必须使用!important

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

你可以在这个小提琴中看到结果。

简单的方法

星期日颜色红这样

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

星期一颜色红这样

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

星期二这样红了

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