-
Notifications
You must be signed in to change notification settings - Fork 711
[css-grid-3][masonry] Make auto-fit do things #10274
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Closed Accepted by CSSWG Resolution
Commenter Satisfied
Commenter has indicated satisfaction with the resolution / edits.
css-grid-3
Masonry Layout
topic: masonry
Comments
The CSS Working Group just discussed
The full IRC log of that discussion<dbaron> fantasai: tab pointed out that the auto-fit value in masonry specs is designed to behave the same as auto-fill<dbaron> fantasai: auto-fill will fit as many columns as fit in the containing block and leave that there <dbaron> fantasai: auto-fit will do that, but then collapse any columns that are free after placement <dbaron> fantasai: so we could do similar in masonry, but if we're doing auto sized columns it might not be as exciting <TabAtkins> q+ <dbaron> fantasai: but we can redistribute the space if you have a fixed # of columns or an auto # of colums that ... <dbaron> fantasai: so we can still do things like collapse the empty columns in masonry <dbaron> fantasai: so if you have fewer items than columns or explicitly placed columns then you can end up with empty tracks <dbaron> florian: any reason not to? <dbaron> fantasai: I can't think of any reason not ot. <dbaron> s/not ot/not to/ <dbaron> TabAtkins: a potential reason: if you move the columns around and potentially change size or gap between them (have spanners), this changes the size of things in the columns because they now have more space to flow into, which could make things shorter and could theoretically change column placement <dbaron> TabAtkins: so your final masonry might end up more ragged than it would otherwise have been <dbaron> TabAtkins: but that's largely a non-issue because your masonry is nearly empty <dbaron> florian: but if you didn't want that, use the other keyword that doesn't do that <dbaron> fantasai: also you can do this after track sizing <dbaron> fantasai: size tracks, place items, figure out what's empty, don't resize the tracks afterwards <dbaron> fantasai: doesn't reduce space into the tracks (like grid), but lets you redistribute spcae using alignment properties <dbaron> fantasai: that track won't get empty, but increased gap size will increase available space to spanning item <dbaron> florian: either way we're discussing whether it does the same as auto-fill, so if you don't want the rejiggering, use auto-fill <dbaron> fantasai: further comments? <dbaron> oriol: a question: if you use the align properties like align-content and set them to stretch, and then we can't stretch the tracks, does stretch not work on masonry? <dbaron> oriol: is it just in this case where you're collapsing tracks... or in general? <dbaron> fantasai: probably need to apply the distribution before placements -- size the tracks, apply alignment, then place items. <dbaron> fantasai: if you want to do this drop tracks and then reapply values... wouldn't apply stretch because we don't want to resize the tracks <dbaron> oriol: then if the values stretch, you have start alignment? fall back to other alignment? <dbaron> fantasai: I think you get start. <dbaron> fantasai: I think you have the same problem in grid if you don't have any auto tracks and you say stretch. <dbaron> fantasai: we might want to give stretch a fallback alignment option. <dbaron> fantasai: should we do it? I see Rachel nodding. <fantasai> RESOLVED: Make auto-fit drop tracks after sizing and placement, and apply content distribution to the tracks again afterward |
fantasai
added a commit
that referenced
this issue
Sep 6, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Closed Accepted by CSSWG Resolution
Commenter Satisfied
Commenter has indicated satisfaction with the resolution / edits.
css-grid-3
Masonry Layout
topic: masonry
As Tab pointed out in #9041 (comment),
auto-fit
repeat value is currently defined to behave identically toauto-fill
in masonry. See https://drafts.csswg.org/css-grid-3/#repeat-auto-fitAFAICT the rationale was that we can't redistribute space to the other tracks since placement depends on sizing in masonry layouts.
However, that doesn't mean we can't use the alignment properties to redistribute space, so I think we should allow
auto-fit
to drop columns just as is does in regular Grid layout, and just forbid it from looping back into the track sizing algorithm.This means that, for example, if you have a masonry grid with 3 items but you could fit 6 columns, we'd drop the extra 3 columns and allow you to use
justify-content: space-around
to distribute the columns.The text was updated successfully, but these errors were encountered: