-3

I have Forget password label in JavaFX application that I applied underline on it. UI I know this isn't possible to do with a basic property, but instead I have applied the following CSS to the label and I don't know how to set Spacing between the text and the underline css

Hassen
  • 11
  • 3
  • 1
    Don't screenshot text like css. Put the text as text in the question, formatted as code (indent four spaces). – jewelsea Feb 24 '22 at 20:13

1 Answers1

0

Specifying the underline offset

JavaFX css does not have a text-underline-offset attribute as far as I know. You could display the link in a WebView and configure the offset using web css rather than JavaFX css, but I wouldn't really recommend that.

JavaFX private implementation uses an underline offset, but that is not public API and cannot be controlled via public API, so I don't think that helps you.

Related info on clickable text (hyperlinks)

For clickable text, you should use a Hyperlink rather than a Label.

See the Hyperlink tutorial and css.

Hyperlink, by default only displays an underline on hover, to have it always displayed, see the related question:

jewelsea
  • 150,031
  • 14
  • 366
  • 406