Re: Publishing the flexible box model

On Jun 4, 2008, at 8:04 PM, L. David Baron wrote:

>
> On Wednesday 2008-06-04 17:50 -0700, Andrew Fedoniouk wrote:
>> Consider following markup:
>>
>> <body>
>> <div>On the top</div>
>> <div>On the bottom</div>
>> </body>
>>
>> and we would like to "stick" second div to the bottom and first one  
>> to
>> the top of the view. How would you
>> accomplish that with XUL flexes? Probably I have missed something but
>> that is impossible with XUL flexes.
>
> <body style="display:box; box-orient:vertical">
>  <div>On the top</div>
>  <div style="box-flex: 1"></div> <!-- maybe needs 'display: box' ? -->
>  <div>On the bottom</div>
> </body>
>
>> Flexibility is really a length unit rather than some property.
>
> No, since some layout models (traditional document layout) use one
> dimension as input and the other as output; you can only flex in a
> dimension that is input to the algorithm.  In the existing CSS
> model, in many cases, there is no sensible height that is input to
> the algorithm (or, depending on how you look at it, multiple heights
> that might be of interest).
>
> -David

If flexible boxes could be said to have a flaw, it's that their use  
often results in extra containers (either used as springs or because  
of changes in alignment and orientation as you nest that necessitate  
the extra container).  I think it might be possible to address this  
issue though as the spec develops (possibly borrowing concepts from  
the Cocoa Interface Builder spring model).

Of course many of the cases where extra containers would be needed  
could be implemented in other ways.  For example, fixed positioning  
can fix something to the top and bottom of a view without the need for  
a separating spring.

Flexible boxes also have two implementations already and a high degree  
of interest from two vendors (Mozilla, Apple).

dave
(hyatt@apple.com)

Received on Thursday, 5 June 2008 01:55:18 UTC