Differences between "standard" css

Pedro Duque Vieira pedro.duquevieira at gmail.com
Fri Jul 6 02:52:40 PDT 2012


I think javafx would benefit if its CSS would support the same keywords and
syntax of the "standard" HTML CSS. However the current reality is that
javafx css differs from the HTML css in various minor ways.

It would be really nice if we could simply grab a css from the web and put
it in javafx and it would simply just work. There is a lot of already built
up knowledge on this area throughout the web and it would be great if we
could leverage that knowledge, also designers coming from other backgrounds
could easily and rapidly adapt to javafx.

Richard had already mentioned this on his article: " JavaFX: The 10,000
Foot View", adding it would also be good if javafx could supported the box
model from HTML for layout.

I don’t think we have to make an exact copy of the HTML CSS but I think we
could try to support it the best way possible.

Here are some of the ways that javafx differs from standard css (not a
comprehensive list, just a list of the ones that come to my mind):

1-     Use of -fx- prefix everywhere.

This was made so that javafx css would not interfere with standard css
written on the same file. However I don't see this scenario coming up that
often, and you can use different identifiers or css files if you happen to
use the two models on the same app.

2-    Effects

Drop shadow and inner shadow syntax differs from HTML syntax

3-  Lack of support for "margin"

4- The ":first-child",  ":first-line", ":first-letter" is not supported

5-The ":active" and ":focus" dynamic pseudo-classes are not supported,
Their name in javafx is  ":pressed" and ":focused"

6- ":link" is not supported

7- JavaFX CSS does not support comma-separated series of font family names
in the -fx-font-family property

8- Not sure but I think the ordering on some css properties is different

And some more debatable ways that could make no sense to support:

9- The optional line height parameter when specifying fonts is not supported

10- No support for p, div, h1, h2, a...

Thanks, best regards,

Pedro Duque Vieira

More information about the openjfx-dev mailing list