[css-grid] fit-content() vs 'stretch' alignment · Issue #1732 · w3c/csswg-drafts · GitHub
Skip to content

[css-grid] fit-content() vs 'stretch' alignment #1732

Closed
@fantasai

Description

@rachelandrew and @mrego found some problems with the spec 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:

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 fixed sizing function 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~

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions