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

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

From: Philip Walton <philip@philipwalton.com>
Date: Mon, 23 Feb 2015 09:01:25 -0800
Message-ID: <CAGRhNhWX4royBMT8Xk4QYUwbjgeTkfbpN3tcKKv+bzMfyasLpQ@mail.gmail.com>
To: www-style list <www-style@w3.org>
Consider the following demo:
http://codepen.io/anon/pen/myLmYW

It contains a 300 by 300 pixel image that is a flex-item and its flex-basis
is set to 150px. The question is: *what should its height be?*

Naturally, I'd assume the image would resize according to its aspect ratio,
but I can't find anything to indicate that in the flex layout algorithm.
>From my (possibly incorrect) reading, the height should remain at its
default 300px value.

When I go through the steps to calculate the cross size of each flex line
<http://dev.w3.org/csswg/css-flexbox-1/#algo-cross-line> I end up being
told that the cross size of the flex line should be the "largest outer
hypothetical cross size".

When I go to determine the hypothetical cross size of each item
<http://dev.w3.org/csswg/css-flexbox-1/#algo-cross-item>, I'm instructed
to "determine the hypothetical cross size of each item by performing layout
with the used main size and the available space, treating auto as
fit-content."

In that last sentence, its unclear to me if I should take into account the
images intrinsic aspect ratio or not. Is there something in the definition
of "fit-content" that I'm missing? Or could the text be more clear to
handle this case?
Received on Monday, 23 February 2015 17:01:57 UTC

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