【发布时间】:2017-01-22 07:11:14
【问题描述】:
????它可能与this 问题重复,但它不起作用。
存在两个类,它们扩展
HBox并有一个TextField元素。我在每个类上添加了一个StyleClass,如下所示:
//for one class
getStyleClass().add("search-box");
//for the other class
getStyleClass().add("libraries-search-box");
所以我用上面的css代码修改了他们
TextField的外观:
.search-box .text-field {
-fx-background-color: white;
-fx-background-insets:3.0;
-fx-background-radius: 5.0;
.....
}
.libraries-search-box .text-field {
-fx-background-color: white;
-fx-background-insets:3.0;
-fx-background-radius: 5.0;
....
}
我想替换重复的代码,我试试:
.search-box , .libraries-search-box .text-field {
-fx-background-color: white;
-fx-background-insets:3.0;
-fx-background-radius: 5.0;
...//
}
但它仅适用于“.libraries-search-box”。我如何让它对两者都有效?
【问题讨论】:
-
.text-field 需要在选择器中的父母双方之后