要为 EkoJr 的答案添加更多细节,从 Jquery UI v1.11.4 开始,如果您添加整个 JQuery UI CSS 样式表,它可能会破坏默认的 Wordpress 主题样式。
因此,您只能添加与滑块组件对应的 CSS 类。这是我使用的类(注意:这些是为ui-darkness 主题构建的):
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
border: 1px solid #666666;
/* this image is from the ui-darkness theme, use the one you'd like */
background: #555555 url("img/jquery-ui/ui-bg_glass_20_555555_1x400.png") 50% 50% repeat-x;
font-weight: bold;
color: #eeeeee;
}
.ui-slider-horizontal .ui-slider-handle {
top: -.3em;
margin-left: -.6em;
}
.ui-slider .ui-slider-handle {
position: absolute;
z-index: 2;
width: 1.2em;
height: 1.2em;
cursor: default;
-ms-touch-action: none;
touch-action: none;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-right,
.ui-corner-br {
border-bottom-right-radius: 6px;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-left,
.ui-corner-bl {
border-bottom-left-radius: 6px;
}
.ui-corner-all,
.ui-corner-top,
.ui-corner-right,
.ui-corner-tr {
border-top-right-radius: 6px;
}
.ui-corner-all,
.ui-corner-top,
.ui-corner-left,
.ui-corner-tl {
border-top-left-radius: 6px;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-right,
.ui-corner-br {
border-bottom-right-radius: 6px;
}
.ui-corner-all,
.ui-corner-bottom,
.ui-corner-left,
.ui-corner-bl {
border-bottom-left-radius: 6px;
}
.ui-corner-all,
.ui-corner-top,
.ui-corner-right,
.ui-corner-tr {
border-top-right-radius: 6px;
}
.ui-corner-all,
.ui-corner-top,
.ui-corner-left,
.ui-corner-tl {
border-top-left-radius: 6px;
}
.ui-widget-content {
border: 1px solid #666666;
/* this image is from the ui-darkness theme, use the one you'd like */
background: #000000 url("img/jquery-ui/ui-bg_inset-soft_25_000000_1x100.png") 50% bottom repeat-x;
color: #ffffff;
}
.ui-widget {
font-family: Segoe UI,Arial,sans-serif;
font-size: 1.1em;
}
.ui-slider-horizontal {
height: .8em;
}
.ui-slider {
position: relative;
text-align: left;
}
另外,请注意,您可以在这些类前面加上您的容器 ID。例如,如果您的滑块的 ID 为“滑块”,请使用:
#slider .ui-state-default,
#slider .ui-widget-content .ui-state-default,
#slider .ui-widget-header .ui-state-default {
border: 1px solid #666666;
/* this image is from the ui-darkness theme, use the one you'd like */
background: #555555 url("img/jquery-ui/ui-bg_glass_20_555555_1x400.png") 50% 50% repeat-x;
font-weight: bold;
color: #eeeeee;
}
....ETC