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

Re: [css3-flexbox] "width: auto" behavior on a flexbox

From: Daniel Holbert <dholbert@mozilla.com>
Date: Wed, 11 Apr 2012 13:31:31 -0700
Message-ID: <4F85EA23.2060202@mozilla.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style list <www-style@w3.org>
Great, thanks for the sanity-check.

~Daniel

On 04/11/2012 01:19 PM, Tab Atkins Jr. wrote:
> On Wed, Apr 11, 2012 at 1:12 PM, Daniel Holbert <dholbert@mozilla.com> wrote:
>> Hi www-style,
>>
>> Basic question: what width should we use for the "width:auto" flexbox here:
>>
>>  <div style="width: 500px">
>>   <div style="display: flexbox; width: auto; background: green">
>>     abc
>>   </div>
>>  </div>
>>
>> Should it be the shrink-wrapped width of its contents "abc", or the size
>> of its containing block (500px)?  (per CSS 2.1 10.3.3 [1])
>>
>> A while ago, I (perhaps incorrectly) got the impression from the spec
>> that auto-width flexboxes were supposed to shrinkwrap their contents.
>> However, I've just noticed that I can't find any mention of auto widths
>> in the current ED or WD, and the webkit nightly implementation doesn't
>> shrink-wrap by default.
>>
>> So, I'm assuming my old "auto = shrink-wrap" interpretation is incorrect
>> and/or outdated, and we're instead supposed to follow CSS 2.1 10.3 on
>> this.  I'm hoping for confirmation that my updated interpretation is
>> correct. :)
>>
>> Thanks,
>> ~Daniel
>>
>> [1] http://www.w3.org/TR/CSS21/visudet.html#blockwidth
> 
> Your updated interpretation is correct.  Flexboxes size as blocks by
> default.  You only shrinkwrap if you're in a condition that normally
> shrinkwraps (like float, or being an inline-flexbox).
> 
> ~TJ
> 
Received on Wednesday, 11 April 2012 20:32:01 GMT

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