Declaring Variable In JavaFX CSS File

前端 未结 5 1019
悲&欢浪女
悲&欢浪女 2020-12-08 20:10

I\'ve been inspecting the \"caspian.css\" distributed by Oracle in the JavaFX runtime library, and I see they have declared some color values as variables. Eg:



        
5条回答
  •  时光说笑
    2020-12-08 20:55

    Just a little correction to your answers: it is possible also with numbers, not only colors.

    For example:

    *{
        -preferred-scroll-bar-thumb-size: 25;
    }
    
    .scroll-bar:vertical .thumb {
        -fx-pref-width: -preferred-scroll-bar-thumb-size;
    }
    

    Works for me, and JavaFx taking the value '25' as '25px' (if I wrote '25px' it would fail). It's not exactly variables as with using less/sass but it can help people that don't need more than this.

提交回复
热议问题