The background-radius us setting the corner radius’s of the 3 backgrounds getting smaller as the backgrounds move in, this makes the gap between the borders a consistent 1 pixel all the way around. The background-insets offsets the backgrounds so they do not 100% paint over each other and the second background is 1px in from the outside and the 3rd background is 2px in from the outside of the button. The first line defines the 3 background fills, first is solid color and the other two are linear gradients.
So for example all you need to make a JavaFX button look like a Windows 7 button is: Then there is a little font tweaking and some subtle effects. So without further ado, here is the result:Īll of these are mostly created with multiple background fill layers each with a gradient.
Or they have said that you could never do that! So I thought I would do a little experiment and try recreating a bunch of common button styles purely using CSS. A number of people have asked me recently can I create this look or that look using CSS in JavaFX.