W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2017

[csswg-drafts] [css-grid] fit-content() vs 'stretch' alignment

From: fantasai via GitHub <sysbot+gh@w3.org>
Date: Thu, 17 Aug 2017 20:08:11 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-251057348-1503000485-sysbot+gh@w3.org>
fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-grid] fit-content() vs 'stretch' alignment ==
@rachelandrew and @mrego [found some problems with the spec](https://bugs.chromium.org/p/chromium/issues/detail?id=755994#c2) for `fit-content()` and its interaction with `stretch` content alignment of the tracks:

> So I thought this was a clear issue and I've already a patch for it. But now reading the specs I'm not 100% sure, so let's clarify this before landing the patch.
> The relevant sections of the spec are:
> * 11.8. Stretch auto Tracks (https://drafts.csswg.org/css-grid/#algo-stretch)
>  This step sizes expands tracks that have an auto max track sizing function by dividing any remaining positive, definite free space equally amongst them.
> * fit-content( <length-percentage> ) (https://drafts.csswg.org/css-grid/#valdef-grid-template-columns-fit-content)
>  Represents the formula min(max-content, max(auto, argument)), which is calculated similar to auto (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is greater than the auto minimum.
> The max track sizing function for the fit-content() tracks is "max(auto, argument)".
In the case "auto" is the maximum should it be considered an "auto max track sizing function" or not?
> Would be ok to avoid stretching in all cases? Should we stretch any of them?
> IMHO, I believe that we should avoid stretching for fit-content(). That would be simpler to implement too. But I'd love to hear the feedback from Rachel and Tab on the topic. Thanks!

When we wrote the spec for `fit-content()`, the `auto` in the formula was intended as a replacement for the `min-content` argument of the shrink-to-fit formula, as is made clear in the parenthetical “(i.e. minmax(auto, max-content))”. Removing the word `auto` and substituting the parenthetical in its place makes the intended behavior much clearer.

However, there is a remaining question: should that `max-content` argument actually be `auto`, i.e. respond to stretching (which is the only difference between `auto` maximums and `max-content` maximums)? It would still be clamped by the argument as Rachel requests, since once the track hits that limit it should be treated as a fixed-size track:

> For this purpose, ''fit-content()'' tracks are treated as ''max-content'' until they reach the limit specified as the ''fit-content()'' argument, after which they are treated as having a <a>fixed sizing function</a> of that argument.

I'm leaning towards yes, since having `fit-content()` behave exactly like `auto` aside from clamping at its argument seems like a useful and friendly behavior, but other thoughts welcome~

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1732 using your GitHub account
Received on Thursday, 17 August 2017 20:08:12 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:16 UTC