繁体   English   中英

如何在JavaFx CSS中更改滑块的颜色?

[英]How to change color of slider thumb in JavaFx CSS?

因此,我想更改滑块上拇指/手柄的大小,填充颜色和边框厚度。 我似乎找不到要更改的属性。 我检查了所有可以找到的文档。 我确定这是一个简单的解决方法。 以下是我最有前途的尝试。 有任何想法吗?

#comfortSlider {

    -fx-control-inner-background: #1354cb; 
    /* This works in changing the track */

}

#comfortSlider:thumb {

    -fx-background-color: #1354cb;
    /* This doesn't work in changing the thumb */

}

为了澄清,这就是我用拇指表示的意思。

例

所以,我要做的就是换线

#comfortSlider:thumb {

#comfortSlider .thumb {

comfortSlider.thumb之间的空间是必需的。 在我的情况下, !important不是必需的,但是如果您需要覆盖其他样式,那么我想应该是。 谢谢@Jonny的帮助。

尝试!important覆盖原始样式。

#comfortSlider{-fx-control-inner-background: #1354cb!important;}

#comfortSlider:thumb{-fx-background-color: #1354cb!important;}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM