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

RE: [css-flexbox] Is intrinsic aspect ratio considered when the flex-basis is definite?

From: Greg Whitworth <gwhit@microsoft.com>
Date: Mon, 23 Feb 2015 22:44:49 +0000
To: Philip Walton <philip@philipwalton.com>
CC: www-style list <www-style@w3.org>, Daniel Holbert <dholbert@mozilla.com>
Message-ID: <BN3PR0301MB0868E1C25095DE6A40C82D03A4290@BN3PR0301MB0868.namprd03.prod.outlook.com>
OOOOOH, you better not top post or Tab will give you a nasty-gram!    ;)

> I was under the impression that the minimum size calculation table you linked to only applied if the flex-basis was `auto`. In this case the flex-basis is `150px` and the grow and shrink properties are both `0`, 
> so I assume that means this flex item's main size is guaranteed to be 150 pixels.

No because each algo has you clamp to the min and max constraint. You start off with the flex basis but in multiple places the spec says to double check and clamp it, for example under flex base size determination:

	# The hypothetical main size is the item’s flex base size clamped according to its min and max main size properties.

The main size properties are width and height respectively, which include their min/max counterparts respectively depending on the direction of your flex container. The reason for this is because if flex-basis was treated the same as width as you state, the flex shortand defaults to 0% = 0px which would have results that people would not want (not being able to see the content).

And since min-width and max-width are left empty they use their default which is auto, and the beginning of the table states:

	# To provide a more reasonable default minimum size for flex items, this specification introduces a new ‘auto’ value as the initial value of the ‘min-width’ and ‘min-height’ properties defined in CSS 2.1.

So if you don't provide a min/max width in your row flex container we have to go through this step which will result in us doing one of the 3 options (clamped size, transferred size, content size).

Interestingly though, this is something that Daniel and I were just discussing that we should explicitly list min-width, min-height, max-width, max-height as main-size properties as this is the only thing that connects all of the dots together in the spec since so much of it depends on each other.

Does that make sense?


Received on Monday, 23 February 2015 22:45:17 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:51 UTC