I have a couple of questions about styling a JavaFX application with CSS Selectors (such as: .table-view
for every TableView
).
I have created a main CSS-file, in which I want to define the universal style properties for my application. For example: every TableView
gets the same color in every screen. I just import the Main.css
in every .css that is associated with a .fxml file.
Now I would like to style every HBox
in a 'sidebar' the same way. I have tried it like this (as suggested in Oracle's documentation):
.sidebar > .hbox {
/* Just some styling */
}
This is not working to my surprise, but the following pieces of code are working:
.sidebar > HBox {
/* Just some styling */
}
.sidebar HBox {
/* Just some styling */
}
Maybe it has something to do with the fact that .sidebar
is a custom style, but I am not sure about this.
So my questions are:
1. Why isn't the first one working?
2. What should be the way to do this? (with .hbox
or HBox
and >
or nothing?)