- From: Alex Mogilevsky <alexmog@microsoft.com>
- Date: Tue, 14 Feb 2012 22:31:08 +0000
- To: Tab Atkins Jr. <jackalmage@gmail.com>, Phil Cupp <pcupp@microsoft.com>
- CC: "www-style@w3.org" <www-style@w3.org>, "fantasai (fantasai.lists@inkedblade.net)" <fantasai.lists@inkedblade.net>
± From: Tab Atkins Jr. [mailto:jackalmage@gmail.com] ± Sent: Tuesday, February 14, 2012 2:05 PM ± ± > 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.) Actually I was thinking that if margins work on main axis it should be just like in alignment: *after* item sizing and *before* pack. Then (again just like in alignment), if there are any auto margins on main axis, pack mode doesn't matter, margins will do the job, with some manual control available. Note that this would be different from treating auto margins as "flex:1" that I was opposed to (still am). Wiring margins into flex calculations with only partial set of input screams incomplete and is asking for adding more controls. But letting auto margins do what they do elsewhere seems useful. So, if the rules were: 1) do flex 2) if there is any space left, a) if there are auto margins on main axis, each gets equal share of free space. Pack is not necessary. b) otherwise apply pack Then spacing non-flexible autosize items becomes piece of cake - and pretty much no learning required other than realizing that it finally works: <div style="display:flexbox; width:100%; height:100%;"> <div style="margin:auto"> Woohoo! I am centered! </div> </div> Sure, it can be done without margins: <div style="display:flexbox; width:100%; height:100%; flex-pack:center;"> <div style="flex-item-align:center;"> Woohoo! I am centered! </div> </div> But if you could do either, which would you do? ± ± 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.) BTW I don't feel strongly either way. Only moderately strong. I think letting margins work keeps it more consistent with the rest of CSS, it is easy to implement (no margin collapsing, don't even think about it). Oh, and if we choose to set auto margins to zero we can't change it later without a new keyword for margin, which will be way less elegant. Alex
Received on Tuesday, 14 February 2012 22:32:07 UTC