Need way to define width and height in CSS

Richard Bair richard.bair at oracle.com
Tue Jan 22 17:15:28 PST 2013


Margins are actually separate, as they are the spacing on the outside of the Node, vs. Insets which is the distance from the edge of the node to the content (padding affects insets, but margins don't).

Right now Margins are handled by each layout manager individually, but I'd like to make them generally defined for all Nodes. However how margins are used is a layout manager specific thing. For example, the CSS spec has instances where margins are collapsed -- but this is unique to the "box model layout manager" used by the web, and our layout managers don't do collapsing of margins. If one were to write a BoxModelPane for example, that layout manager could follow all the normal CSS layout rules.

Richard

On Jan 22, 2013, at 2:38 PM, Pedro Duque Vieira <pedro.duquevieira at gmail.com> wrote:

> I'll press 2 :)
> 
> Right now the state of things is a bit strange, because you have to use padding to define the width/height of regions.
> Margins would also be a nice addition, I don't know whether insets already cover the use case for margins but naming it margins would be more "css compliant".
> 
> Cheers,
> 
> On Tue, Jan 22, 2013 at 7:38 PM, Richard Bair <richard.bair at oracle.com> wrote:
> 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 (http://javafx-jira.kenai.com/browse/RT-20906). 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.
> 
> Richard
> 
> On Dec 11, 2012, at 3:50 PM, Pedro Duque Vieira <pedro.duquevieira at gmail.com> 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
> 
> 
> 
> 
> -- 
> Pedro Duque Vieira



More information about the openjfx-dev mailing list