JavaFX CSS styling of TextArea does not work

css, java, javafx

Solution

You need to set the content:

  .text-area .content{
      -fx-background-color: black;
  }

...

Or see this answer maybe: Transparent background of a textarea in JavaFX 8

Problem

I'm writing a simple JavaFX application, but I can't get some of the CSS styling to work. The problem is the `-fx-background-color` property for my `TextArea`. This is the relevant CSS: ``` .text-area { -fx-font-family: Consolas; -fx-highlight-fill: #00ff00; -fx-highlight-text-fill: #000000; -fx-text-fill: #00ff00; -fx-background-color: #000000; } ``` All the fields perform as expected, except `-fx-background-color`, which apparently does nothing. I still have the default white background. As you can see in the picture, the `TextField` below, which has identical CSS, but does apply the background color as expected. Picture of my problem Any clues?

Original source

Related problems