代码之家  ›  专栏  ›  技术社区  ›  Riley Fitzpatrick

如何在JavaFXCSS中更改滑块拇指的颜色?

  •  0
  • Riley Fitzpatrick  · 技术社区  · 7 年前

    #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 */
    
    }
    

    澄清一下,这就是我所说的拇指。

    example

    2 回复  |  直到 7 年前
        1
  •  2
  •   Riley Fitzpatrick    7 年前

    所以,我所做的就是改变路线

    #comfortSlider:thumb {
    

    #comfortSlider .thumb {
    

    间隔 comfortSlider .thumb 这是必要的。 !important

        2
  •  1
  •   Jonny    7 年前

    尝试覆盖原始样式很重要。

    #comfortSlider{-fx-control-inner-background: #1354cb!important;}
    
    #comfortSlider:thumb{-fx-background-color: #1354cb!important;}
    
    推荐文章