Re: [csswg-drafts] [css-grid-3][masonry] Handling negative margins and dense packing for baseline calculation in the masonry axis (#13165)

Similar to the other cases, I don't think negative margins should factor into any first/last calculations. We select the first/last element based on placement, then look at where it's baseline is (which can be affected by margins/etc), and that's it.

Wrt dense packing, in Grid we care about densely-packed items the same as any other; what matters is just if they're in the first/last track, for any reason. Same thing should apply here, I believe.

That is, we rely on the placement rules (including dense packing) to determine what the *first* and *last* items placed in each track are. Then we lay out the items, and among the already-selected first/last, take the highest/lowest baselines, as needed.

This would result in:

* Example 1, using Item 1 for the first baseline. (Item 3 is placed later in track 1, so isn't consulted.)
* Example 2, using Item 3 for the 3rd column baseline. (Item 3 is densely-placed earlier in track 3 than Item 2.)
* Example 3, using Item 2 for the first baseline. (Item 5 is placed later in track 2, so isn't consulted.)

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


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

Received on Thursday, 4 December 2025 22:34:41 UTC