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

RE: [css3-flexbox] remove flex() function

From: Alex Mogilevsky <alexmog@microsoft.com>
Date: Sat, 17 Dec 2011 20:53:55 +0000
To: Tab Atkins Jr. <jackalmage@gmail.com>, Tony Chang <tony@chromium.org>
CC: "www-style@w3.org list" <www-style@w3.org>, Ojan Vafai <ojan@google.com>
Message-ID: <D51C9E849DDD0D4EA38C2E539856928412D86BF2@TK5EX14MBXC218.redmond.corp.microsoft.com>
± From: Tab Atkins Jr. [mailto:jackalmage@gmail.com] 
± Sent: Friday, December 16, 2011 3:40 PM
± 
± Oof, I forget about min/max.  It's kinda silly to switch away from 
± 'width' to avoid being tied to a physical direction when min/max still 
± tie you down.  So yeah, I guess we'd have to include min and max in the 
± property, for something like:
± 
± flex: [ <pos-flex> <neg-flex>? ] || <preferred-size> || [ max <length-or-
± %> ] || [ min <length-or-%> ]
 
Min/max sizes *should* be directional, they have to do with known qualities of content. I don't recall lack of flex-specific min/max ever being raised as a problem for old syntax... I would very much prefer to not add another redundant measurement (even optional) unless there is a strong use case for it.

± > - If width and preferred size are omitted, do we still flex with a 
± > preferred size of 0?
± 
± It would have the same defaults as normal, which is to default the 
± preferred size to 0.

Agree

± > - If preferred size is omitted, but width is provided, do we 
± > completely ignore the width and use the default preferred size of 0?
± 
± Yeah, that seems the sanest thing.

Also agree, but I think there should be an option to use specified width. Perhaps 'auto' preferred width could mean that 'width' property is used? So

	flex:1 auto; width:100px;

would be same as

	flex:1 100px;

what do you think?

± > - What is the initial value of flex? It would have to be "0 0 auto" to 
± > get the same behavior as the current spec (no flexing and auto 
± > sizing).  It's a bit weird that if you then use flex: 100px, it 
± > resolves to an initial value of "1 0 100px".
± 
± Hmm, I don't find that particularly weirder than the fact that the 
± default for 'width' is "auto" (equivalent to "flex(0 0 auto)"), but 
± specifying "width:flex(100px)" is equivalent to "width: flex(1 0 100px)".

Actually with this change of syntax, "flex:100px" really should mean "flex:0 0 100px". That would be much cleaner design and it is how initial values behave elsewhere.

Note that if you really think default flex should be "1" you can make that initial value. I am not suggesting that's the right thing to do but it would also be consistent.

± 
± > It's also a bit weird that, e.g., if you open a document using 
± > developer tools and you want to change the size of a flex item, 
± > changing width won't do anything.  This could also be confusing for 
± > user style sheets or user scripts.
± 
± Yes, those are some downsides.

Yes, and it makes me uncomfortable every time I think about it. It may be not intuitive if 'width' in flexbox is <preferred-width>, but it will be confusing only first couple of times somebody uses flexbox, and perfectly natural for the next 60 years that somebody uses CSS...

--Alex
Received on Saturday, 17 December 2011 20:54:37 GMT

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