W3C home > Mailing lists > Public > www-style@w3.org > February 2012

RE: [css3-flexbox] ED updated: algorithms and 'flex' property

From: Alex Mogilevsky <alexmog@microsoft.com>
Date: Wed, 29 Feb 2012 02:58:58 +0000
To: Daniel Holbert <dholbert@mozilla.com>, Tony Chang <tony@chromium.org>
CC: Tab Atkins Jr. <jackalmage@gmail.com>, "www-style@w3.org list" <www-style@w3.org>
Message-ID: <D51C9E849DDD0D4EA38C2E539856928412EB55DC@TK5EX14MBXC214.redmond.corp.microsoft.com>
 From: Daniel Holbert [mailto:dholbert@mozilla.com] 
 Sent: Tuesday, February 28, 2012 5:59 PM
 
 On 02/28/2012 04:59 PM, Tony Chang wrote:
 > I like this idea.  To expand on it further, we would have three 
 > separate properties (e.g., positive-flex, negative-flex, 
 > flex-preferred-size) and flex would just be a shorthand.  All would 
 > default to 0.  If we're not in a flexing context or if positive flex 
 > and negative flex are both 0, we would use width/height.  We only 
 use 
 > flex-preferred-size if we have a positive or negative flex value.
 
 I like the sound of this too -- one thing though.  It sounds like with 
 your proposed semantics, the 50px here would be ignored:
 
   <div style="display: flexbox">
     <div style="flex: 0 0 50px"/>
   </div>
 
 That seems undesirable.

That is exactly the problem with the meaning of "preferred size" with and without flex. 

Without flex, preferred size is the size, and it totally makes sense that 'width' and 'height' express the preference.

With flex, preferred size is the starting point of flexing, often zero, but that zero is by no means the size the items prefer to get.

I think the current syntax is a very reasonable compromise:

	* When flex is not specified - no flexibility and
	  width/height work as usual
	* When flex is specified, default "preferred size" is zero,
 	  overriding width/height
	* "flex:1 100px; width:200px;" makes width ignored, not perfect,
	  but is clear enough since there are two values and one must win
	* "flex:1 auto" (no width/height) means 
	  "calculate natural size, then flex" 
	* "flex:1 auto; width:50%;" is the only case that can lead 
	  to confusion. But if you think about it as 'width' property
	  providing additional info for calculating "natural size",
	  it makes perfect sense. 

Although I have noted my initial preferences on some of the option here, I would very much prefer at this point to finalize the syntax, and so far I am not seeing options that have better chance of survival than what we have...

Alex
Received on Wednesday, 29 February 2012 02:59:33 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:51 GMT