I wrote this css code for button pressed
.button:pressed {
-fx-scale-y: 0.9;
-fx-scale-x: 0.9;
}
and this for button hover
.button:hover {
-fx-background-color: #383838;
-fx-scale-y: 1.1;
}
and it doesn't scale down because for the button to be clicked it obviously has to be hovered. Is there any way to cancel the hover code when the button is being pressed?
Either:
reverse the order of the rules, so that the rule for
pressedcomes after the rule forhover(and thus takes precedence):or, make the rule for
pressedmore specific than the rule forhoverby explicitly applying it to a button that is both pressed and hovered: