Need way to define width and height in CSS

Richard Bair richard.bair at
Tue Jan 22 11:38:05 PST 2013

There are a few related issues that have come up over time, and I want to make sure we're on the same page. Some nodes have a width and height, other's don't. And for those that do, they aren't always a ResizableNode (like a Rectangle). If this is your issue, press 1. HTML CSS is a combination of visual and layout information. If your issue is that you would like to describe layout information from CSS, press 2.


I assume you are interested in #2. If this is so, there are two things. First ( This issue is basically asking to be able to set pref-width etc from CSS. I think this makes great sense. Also we want to be able to set Margins from CSS like we can do padding today. These things make sense and are just something that needs doing. But one thing that doesn't really make sense is "width:100%". Partly this is because our system is based on layout managers who are going to set the width / height based on the pref width / pref height etc. Partly this is because in HTML CSS, they only have one "layout manager" (box layout) and so some things which make sense in HTML CSS wouldn't in FX CSS when placed in some kind of layout container.

We could do something more complicated, like "if width / height are set by anything other than a layout container, then the layout container won't set the width / or height." But that kind of hidden state is usually problematic.


On Dec 11, 2012, at 3:50 PM, Pedro Duque Vieira <pedro.duquevieira at> wrote:

> Hi,
> After some practice writing  JavaFX CSS one thing as become clear: a way to
> clearly define a width and a height is lacking.
> In standard w3c css you have width and height, on JavaFX CSS you have
> padding - look at the way the size of the mark on a checkbox is defined in
> caspian. Padding isn't the nicest way to define this because it is supposed
> to define the spacing between an element and it's contents.
> Cheers,
> -- 
> Pedro Duque Vieira

More information about the openjfx-dev mailing list