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

RE: [css-flexbox] Behaviour of percentage heights in column direction

From: Peter Salas <psalas@microsoft.com>
Date: Tue, 10 Feb 2015 00:14:40 +0000
To: Daniel Holbert <dholbert@mozilla.com>, Tab Atkins Jr. <jackalmage@gmail.com>
CC: www-style list <www-style@w3.org>
Message-ID: <BY2PR03MB377AD7AF1141DE1EA96997EDD240@BY2PR03MB377.namprd03.prod.outlook.com>
Daniel Holbert wrote:
> 
> On 02/09/2015 02:23 PM, Peter Salas wrote:
> > In Chrome, FF, and IE, a nested flex container will flex its children up to the
> given height:
> >
> > http://jsfiddle.net/7s1w4wen/

> 
> That's an interesting case, but I'm not sure it's directly analogous to the
> percent-height scenario.
> 
> With percent-sizing, a percent-sized element traditionally *may or may
> not* have its percent size be resolvable, based on whether the parent's size
> depends on the percent-sized thing.
> 
> In contrast: with flexbox & "flex" values, *whatever a flex container's main
> size ends up being*, it distributes that space among its children according to
> their flexibilities & the flex algorithm.  This is true regardless of how it reaches
> its final size & whether that final size depends on its children's sizes.

Fair points.  I guess what I'm proposing would be a more radical reconsideration of when percentage heights resolve, based on a couple observations:

a) Treating a percentage height as "auto" means ignoring what the author specified.
b) Newer layouts like flex and grid often explicitly determine their children's heights based on many factors (including the content of that child, the content of siblings, available space, etc.)

Rather than only resolving percentages in cases where the height doesn't depend at all on the content, we could instead resolve percentages unless the height depends solely on the content (e.g. an auto height static block, or an auto-height non-stretched flex item in a row flex container). 

Instead of trying to carve out cases in these new algorithms where the height doesn't depend at all on the content, we could carve out the cases where it only depends on the content.  In other words, I think that ignoring percentage heights should be the exception, rather than the rule.

Of course, this conflicts with CSS 2.2's current definition of the 'height' property, which says "If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the used height is calculated as if 'auto' was specified."  On the other hand, the caveat about absolutely positioned elements suggests that it isn't necessarily universal.

Thoughts?

-Peter
Received on Tuesday, 10 February 2015 00:15:21 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:52:01 UTC