Re: [csswg-drafts] [css-grid-3][Masonry] Behavior of repeat(auto-fit, auto) in Masonry (#12485)

This question somewhat expands to how repeat(auto-fit, <track size(s)>) works in Masonry in general.

For example:
```
<style>
.masonry {
    display: masonry;
    grid-template-columns: repeat(auto-fit, 100px);
    width: 400px;
    height: 200px;
}
.masonry > div {
    width: 50px;
    height: 50px;
}
</style>
  <div class="masonry">
    <div>
      Number 1
    </div>
    <div>
      Number 2
    </div>
    <div>
      Number 3
    </div>
  </div>
```
In this case, we apply the contribution of every item to every column (in this case, 4 auto repeat tracks of 100px). In the current Chromium implementation, we don't collapse the 4th track even though it has no items because we apply track collapsing before items are officially placed, and since we have a contribution applied to that track, we don't collapse it.

My guess is that we'd need the track sizing algorithm for masonry to be updated such that handling of collapsed tracks happens after placement (although I don't see track collapsing noted in the track sizing algo explicitly, so maybe it is implied to just work in both grid and masonry wherever makes the most sense)

-- 
GitHub Notification of comment by alisonmaher
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12485#issuecomment-3084895208 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 17 July 2025 17:36:37 UTC