I'm kind of new to CSS and was wondering if anyone can answer a questions for me.
In a lot of CSS sample code I see sections like this:
.listview{
...
-fx-background-color: -fx-box-border, -fx-control-inner-background ;
...
}
So my question is where do the -fx-box-border, -fx-control-inner-background values come from? They appear to be connstants defined somewhere but where and what are their values?
Thanks in advance.
解决方案
Values such as -fx-background-color are "looked-up colors" defined in the default JavaFX (8) stylesheet, modena.css.
You can find out their values (and many other things) by examining the default stylesheet that ships with your Java Runtime Environment (JRE).
jar xvf $JAVA_HOME/jre/lib/ext/jfxrt.jar com/sun/javafx/scene/control/skin/modena/modena.css
cat com/sun/javafx/scene/control/skin/modena/modena.css
(Adjust the above command for your installed JRE location if JAVA_HOME is not set in your environment).
Definition of a "looked-up-color", copied from the JavaFX CSS reference guide:
With looked-up colors you can refer to any other color property that is set on the current node or any of its parents. This is a very powerful feature, as it allows a generic palette of colors to be specified on the scene then used thoughout the application. If you want to change one of those palette colors you can do so at any level in the scene tree and it will affect that node and all its decendents. Looked-up colors are not looked up until they are applied, so they are live and react to any style changes that might occur, such as replacing a palette color at runtime with the "style" property on a node.
In the following example, all background color of all buttons uses the looked up color "abc".
.root { abc: #f00 }
.button { -fx-background-color: abc }