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

Re: [css3-flexbox] Initial value of 'flex' should make flexible boxes

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 20 Apr 2012 15:52:46 -0700
Message-ID: <CAAWBYDDa=Mq0W++XORJodskWt-5B9c8H8ELj2cv3KNaWm7Du7A@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: "www-style@w3.org" <www-style@w3.org>
On Fri, Apr 20, 2012 at 3:19 PM, fantasai <fantasai.lists@inkedblade.net> wrote:
> Currently the initial value of 'flex' is 'none', which means "use
> width/height
> and don't be flexible". Wouldn't it make more sense if it was "use
> width/height
> and be flexible", i.e. 'auto'?

No, you want the current defaults, as it makes common cases simpler to
understand.

Take a simple example, like a two-column layout where the left column
should be 200px wide and the right column should take the remaining
space.  If things were flexible by default, you'd have to do:

.container { display:flexbox; }
.left { width: 200px; flex: 0; }

This seems less intuitive than the current code:

.container { display: flexbox; }
.left { width: 200px; }
.right { flex: 1; }

Having to explicitly turn on flexing just seems more natural than
having to explicitly turn it *off* in some situations.

(In the old world of the flex() function, width:auto computed to
flex(1).  That was even better - all you had to say was:

.container { display: flexbox; }
.left { width: 200px; }

...and you were done. I wish I could have salvaged that approach, but
alas, it had too many problems.)

~TJ
Received on Friday, 20 April 2012 22:53:35 GMT

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