2

I have some JavaFX checkboxes and want to style labels that I've assigned to them. I've put this in my .css file, but it doesn't change anything:

.check-box .label {
    -fx-font-size: 18;
    -fx-font-weight: bold;
}

What am I doing wrong?

1 Answer 1

7

Assuming that when you say you've "assigned labels to the check boxes" you mean that you've set text on them (either CheckBox cbox = new CheckBox("Check this"); or cbox.setText("Check this");, then you just need to omit the .label from the css:

.check-box {
    -fx-font-size: 18;
    -fx-font-weight: bold;
}
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot! Apparently, the time I've used it without ".label", I was failing cause I used ".CheckBox" :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.