问题描述
我对CSS很陌生,想知道是否有人可以为我回答问题。
I'm kind of new to CSS and was wondering if anyone can answer a questions for me.
在很多CSS示例代码中,我看到这样的部分:
In a lot of CSS sample code I see sections like this:
.listview{
...
-fx-background-color: -fx-box-border, -fx-control-inner-background ;
...
}
所以我的问题是-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?
提前致谢。
推荐答案
-fx-background-color
等值是, modena.css
。
您可以通过检查Java运行时环境(JRE)附带的默认样式表来查找它们的值(以及许多其他内容)。
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
(如果您的环境中未设置JAVA_HOME,请调整已安装的JRE位置的上述命令。)
(Adjust the above command for your installed JRE location if JAVA_HOME is not set in your environment).
查找颜色的定义,从JavaFX CSS参考指南中复制
Definition of a "looked-up-color", copied from the JavaFX CSS reference guide:
在以下示例中,所有按钮的所有背景颜色都使用查找颜色abc。
In the following example, all background color of all buttons uses the looked up color "abc".
.root { abc: #f00 }
.button { -fx-background-color: abc }
这篇关于JavaFX和CSS样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!