是否可以使用自定义样式设置jQuery UI的Datepicker样式,但保留相同的功能?例如:
答案 0 :(得分:10)
你可以用一点CSS覆盖。例如,我更改了以下内容:
.ui-datepicker td { border: 1px solid #CCC; padding: 0; } .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: solid #FFF; border-width: 1px 0 0 1px; }
立即得到的东西与你想要的东西更相似。
答案 1 :(得分:0)
您可以使用以下代码,这与您的图片非常相似。
需要包含!important
来覆盖JavaScript。
感谢上面的Alex,我已经把他的答案包括在内了。
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {border: solid #FFF!important;border-width: 1px 0 0 1px!important;}
.ui-datepicker td {border: 1px solid #CCC!important;padding: 0!important}
.ui-datepicker-calendar thead tr th span {font-size: 12px!important;text-transform: uppercase!important;}
.ui-widget-header {background: #2d2d2d!important;border: 0!important}
.ui-datepicker .ui-datepicker-title select {background: #2d2d2d!important; color: #fff!important;font-size: 15px!important;}
.ui-widget-header .ui-icon {background-image: none!important;}
.ui-datepicker .ui-datepicker-title {margin-top: 4px!important;}
#ui-datepicker-div {padding: 0;width: 325px!important;}
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default, .ui-button, html .ui-button.ui-state-disabled:hover, html .ui-button.ui-state-disabled:active {
background: linear-gradient(20deg,#e2e2e2,#eeeeee)!important;}
.ui-state-default {font-size: 13px;font-weight: bold!important;}
.ui-datepicker td span, .ui-datepicker td a {padding: 0!important;text-align: center!important;}
.ui-datepicker select.ui-datepicker-month, .ui-datepicker select.ui-datepicker-year {width: 33%!important;padding-left: 22px!important;}
.ui-datepicker th {padding: 0em .3em 0.2em!important;}
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus, .ui-button:hover, .ui-button:focus {
background: #3fadb6!important;
box-shadow: inset 0px 0px 10px #4ea3ab, inset 0px 0px 20px #2a97a0!important;
color: #ffffff!important;}
.ui-datepicker table {margin: 0!important;}
.ui-datepicker-next, .ui-datepicker-prev {border: 0!important;}
/*Right Arrow*/
.ui-datepicker .ui-datepicker-next span {width: 0!important;height: 0!important;border-left: 10px solid white!important;
border-right: 8px solid transparent!important;
border-bottom: 8px solid transparent!important;
border-top: 8px solid transparent!important;
}
/*Left Arrow*/
.ui-datepicker .ui-datepicker-prev span {width: 0!important;height: 0!important;border-right: 10px solid white!important;
border-left: 8px solid transparent!important;
border-bottom: 8px solid transparent!important;
border-top: 8px solid transparent!important;
}