Differences between "standard" css

David Grieve david.grieve at oracle.com
Fri Jul 6 07:50:17 PDT 2012


On Jul 6, 2012, at 10:05 AM, Pedro Duque Vieira wrote:

> David, thanks for answering.
> 
> The need for the -fx- prefix is more for taking a JavaFX CSS file and using it in a browser.  We should support border-color, for example, but  border-color only supports one layer of color whereas -fx-border-color supports many layers of paint 
> 
> Isn't it still possible to do that without the -fx- prefix? Can't -fx-border-color be named border-color and still support both various layers of paint and only one? 
> Is there any practical advantage in using a javafx css file in a browser? would someone do that?
> The point is I think the -fx- prefix brings less advantages than not having it.

If we are to follow the W3C standard, which is a "good thing" ™, then we need to employ the -fx- prefix where javafx css syntax is not the same as, or not a part of, the W3C standard since such syntax would be considered a "vendor specific extension." 

>  This is another place where we need to reconcile JavaFX CSS with W3C standard CSS. The pseudo-class names in JavaFX match the JavaFX property names and they should probably be prefixed with -fx-. 
> Wouldn't it be possible to have both? Both doing the same but with different names for the purpose of supporting "standard" css.
> 

That is the objective, yes. 

> Also I remembered one more point: in "standard" css you don't have background-radius: border-radius affects both border and background. While in javafx css border-radius doesn't make any change to the background.
> 

A backgrounds is handled by Region as separate a Rectangle from a border, hence the -fx-background-radius.

As an aside, it is more efficient for JavaFX to paint a fill than a stroke. A skin for a Button for example (as styled in caspian.css) is layers of background fill even though it looks like one background fill with several borders. 


David Grieve | Principal Member of Technical Staff
Mobile: +16033121013 
Oracle Java Client UI and Tools
Durham, NH 03824 
 Oracle is committed to developing practices and products that help protect the environment



More information about the openjfx-dev mailing list