.slider .track {
-fx-pref-width: 300px;
}
.slider .axis-tick-label {
-fx-text-fill: white;
}
My feeble attempts of writing CSS styles for the slider both don't work. I'm 100% sure my syntax is off. Any help?
我为滑块编写CSS样式的微弱尝试都不起作用。我100%确定我的语法已关闭。有帮助吗?
1 个解决方案
#1
2
You can do it by setting the -fx-pref-width
attribute of slider
and setting the -fx-tick-label-fill
attribute of .slider .axis
:
您可以通过设置滑块的-fx-pref-width属性并设置.slider .axis的-fx-tick-label-fill属性来实现:
.slider { -fx-pref-width: 300px; }
.slider .axis { -fx-tick-label-fill: white; }
Note: For vertical Slider
, to affect the length of the track, you have to use the -fx-pref-height
attribute:
注意:对于垂直滑块,要影响轨道的长度,必须使用-fx-pref-height属性:
.slider:vertical { -fx-pref-height:300px; }
#1
2
You can do it by setting the -fx-pref-width
attribute of slider
and setting the -fx-tick-label-fill
attribute of .slider .axis
:
您可以通过设置滑块的-fx-pref-width属性并设置.slider .axis的-fx-tick-label-fill属性来实现:
.slider { -fx-pref-width: 300px; }
.slider .axis { -fx-tick-label-fill: white; }
Note: For vertical Slider
, to affect the length of the track, you have to use the -fx-pref-height
attribute:
注意:对于垂直滑块,要影响轨道的长度,必须使用-fx-pref-height属性:
.slider:vertical { -fx-pref-height:300px; }