RE: [css3-flexbox] flex-grow initial value should be 0px

± From: Tab Atkins Jr. [mailto:jackalmage@gmail.com] 
± Sent: Tuesday, June 05, 2012 4:05 PM
± 
± On Tue, Jun 5, 2012 at 3:04 PM, Alex Mogilevsky <alexmog@microsoft.com> 
± wrote:
± > I don't think it matters how awesome anonymous items are, or not. It 
± is very easy to style anonymous items, only takes 11 character... like 
± this: "<div></div>".
± 
± Agreed, anonymous flex items are a non-issue.  They're handled to keep 
± the model sane, not to provide a useful feature.
± 
± 
± Since no one has strong objections to any of the options, and among the 
± implementors in the thread, 2 are for C and 1 is for B (adding in 
± editors, it's 3 for C, 1 for B, and 1 neutral between B and C), I think 
± we should modify the spec for C.  Morten can weigh in as the last 
± implementor, but his choice will either be with the majority, or tie the 
± implementors but keep the +editors numbers favoring C.

One thing that I don’t like about "C" is that it is not a single value or keyword and it is not at all natural to set explicitly.

If somebody has flexible and inflexible items and they really want to (or must) be explicit about it, they have options:

 .flex0 { flex:0; } // always at min-content
 .flex1 { flex:1; } // "absolute" flex

'min-content' is rarely the preferred size though. So it will likely be

 .flex0 { flex:0 0 auto; } // specified size, won't shrink
or
 .flex0 { flex:0 1 auto; } // specified size, shrinks

The author will have to make the choice (with understanding what exactly they want), or look it up and get the initial value. They can of course

 .flex0 { flex:initial; }

Which will work but it's unusual and not all that explicit either.

It seems that given the choices, style for explicit flex settings will look like this:

 .flex0 { flex-grow:0; }
 .flex1 { flex-grow:1; }

No matter how you want to encourage the use of 'flex' property, defaults are just getting too complicated and component properties seem safer and cleaner.

Received on Wednesday, 6 June 2012 00:46:57 UTC