Re: [css3-grid] [css3-flexbox] Stretch alignment in flexbox and grid

On Mon, Feb 13, 2012 at 11:49 AM, Phil Cupp <pcupp@microsoft.com> wrote:
> I saw in the minutes from Paris discussion about margins and
> flex-item-align.  I didn’t see any mention of stretch alignment though which
> is what I think makes the treatment of margins interesting.  In the grid,
> stretch alignment mimics the way that stretching a block element’s width in
> the normal flow works[1] (except we drop the paragraph that says it should
> be dropped).  That applies to both the width and height of grid items when
> they have grid-column-align or grid-row-align stretch.  If flex-item-align
> behaves the same way, then I think we have a consistent algorithm for
> stretching an item’s box so that it touches the edges of the space afforded
> to it by its parent layout.

Yes, your example rendering is correct.  It matches what Flexbox will
say once I make the margin-related edits.

> Note I think the same rules should probably
> apply to flex-pack: justify as well, since it seems like another form of
> stretching.

I don't understand.  flex-pack:justify doesn't stretch anything - it
distributes the free space around the items.  The analogue of
"stretch" in the main axis is making the item flexible.
(flex-align:stretch is just the keyword version of making the
cross-size flexible.)

I think auto margins should continue to resolve to 0 in the main axis.
Flexible margins are incompatible with multi-line flexboxes - *none*
of the flex-pack values can be simulated with margins in a multi-line
flexbox unless you know precisely where breaks will occur ahead of
time. Flexible margins *can* do somewhat useful things in a
single-line flexbox (they can be used to simulate XUL springs), but I
don't think it's worth it to include them.

(I don't really think that flexible auto margins in the cross axis are
worth it, either, but Alex seems to feel strongly, and I don't have a
technical argument against them, just an aesthetic one.)

~TJ

Received on Tuesday, 14 February 2012 22:05:23 UTC