W3C home > Mailing lists > Public > www-style@w3.org > December 2011

RE: [css3-flexbox] alignment test

From: Alex Mogilevsky <alexmog@microsoft.com>
Date: Sat, 10 Dec 2011 03:35:12 +0000
To: Tab Atkins Jr. <jackalmage@gmail.com>
CC: Tony Chang <tony@chromium.org>, "www-style@w3.org list" <www-style@w3.org>, John Jansen <John.Jansen@microsoft.com>, Arron Eicholz <Arron.Eicholz@microsoft.com>, Rossen Atanassov <Rossen.Atanassov@microsoft.com>
Message-ID: <D51C9E849DDD0D4EA38C2E539856928412D8026B@TK5EX14MBXC218.redmond.corp.microsoft.com>
± From: Tab Atkins Jr. [mailto:jackalmage@gmail.com] 
± Sent: Wednesday, December 07, 2011 10:59 AM
± I was convinced against main-axis auto margins being flexible, since they 
± complicate the layout model without really working well (since you can't 
± control the flexibility - I liked them a lot more when they accepted the flex() 
± function).  So, the spec currently resolves them to 0 instead (or should, if I 
± accidentally left out the detail).  This matches both Firefox's and WebKit's 
± behavior for -prefix-box.
± For consistency, cross-axis margins should do the same.  As far as I can tell, 
± this *also* matches Firefox's and WebKit's behavior.

Consistency is a good thing, but it is just one of the reasons to consider. In normal flow, 'margin-left' and 'margin-right' work for alignment, but 'margin-top' and 'margin-bottom' don't (and those collapse too). 

The margin alignment in 2009 spec is *consistent* with normal flow: if you change a container from "display:block" to "display:box;box-orient:vertical", children preserve their horizontal alignment.

± Further, your examples clearly show that margins don't accomplish anything 
± beyond what flex-align already does, so it doesn't seem like a valuable 
± addition.
± Given the above, I'd like to keep flex-align on the flexbox items.
± The only downside of this is that you can't control the alignment of anonymous 
± items, but I don't think that's a big deal - anonymous items only exist to keep 
± the layout algorithm sane, not to provide useful functionality that authors 
± should depend on.  You can't control properties of anonymous table-cells 
± either, after all.

I actually think applying 'flex-align' to flexbox is actually a good idea.

	1) In vast majority of cases all flex items have same alignment
	2) Exceptional cases where per-item alignment is needed are easily handled with margins (as my example shows)
	3) Alignment applies to anonymous items

I realize that the above benefits are not super strong, but I don't really see what value per-item alignment brings to offset those... 

I think we went for per-item alignment just because we didn't realize that auto margins can be useful there. If it was a mistake we can still fix it.


Received on Saturday, 10 December 2011 03:35:43 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:08 UTC