Textfield CSS styling using JavaFx

前端 未结 2 1558
挽巷
挽巷 2020-12-15 14:15

I\'m trying to style some textfields using JavaFX, but I\'m not getting desired results. My goal is to have the textfield be represented by a singular underline. Here\'s my

2条回答
  •  时光说笑
    2020-12-15 14:52

    Since you only want an underline, the minimum things you will need are

    .text-field {
      -fx-border-color: grey;
      -fx-border width: 0 0 1 0; // top, right, bottom, left
      -fx-background-color: transparent;
    }
    

    This will change the border color to grey, set the border width to 0 for everything but the bottom border, and back the textfield's background transparent so it is not white.

提交回复
热议问题