Skip to content

[css-grid-3][masonry] For align-items/justify-items, should fill-reverse affect the definition of start and end? #14052

Open

Description

@celestepan

When using grid-lanes-direction: column/row fill-reverse, should we adjust our definitions of "start" and "end" for content alignment?

In the case of regular stacking axis alignment, if an item has align-self: end, it aligns to the bottom of the container:

Image

In the case that we have fill-reverse enabled, items would fill up the container starting from the bottom. If we were to specify align-self: end to an item, should it still align to the bottom of the container:

Image

Or align to the top of the container, which is technically near the "end" of where items are placed:

Image

In CSS Flex, if we try to align items along the main axis where things are placed in reverse:

<div style="display: flex; gap: 10px; width: min-content; height: 250px; border: 2px solid; flex-direction: column-reverse; justify-content: flex-end;">
   <div style="width: 30px; height: 30px; background: pink;"></div>
   <div style="width: 30px; height: 30px; background: pink;"></div>
   <div style="width: 30px; height: 30px; background: pink;"></div>
   <div style="width: 30px; height: 30px; background: lightgreen;"></div>
</div>

Using justify-content: flex-end moves items along the main axis to the TOP of the container:
Image

I do think that fill-reverse should only be changing the behavior of auto-placed items, and align-self/items: start in columns should still align items to the original start of the container. It would be confusing if align-content: start moved all (fill-reversed) items to the bottom of the container in the column direction, and it would be confusing if align-items didn't have the same direction as align-content.

The same question applies to track-reverse -- when that's enabled, do we change where alignment for the grid-axis should be as well? ie, if we have track-reverse on a column container, would justify-items center items to the left or to the right?

Activity

  1. celestepan commented on Jun 15, 2026

    @celestepan
    ContributorAuthor
  2. changed the title [-][css-grid-3][masonry] For `align-items`/`justify-items`, should `fill-reverse affect the definition of `start` and `end`?[/-] [+][css-grid-3][masonry] For `align-items`/`justify-items`, should `fill-reverse` affect the definition of `start` and `end`?[/+] on Jun 16, 2026
  3. Loirooriol commented on Jun 16, 2026

    @Loirooriol
    Contributor

    Flex layout has flex-start and flex-end. It would seem inconsistent to redefine start and end for masonry. But adding new keywords for each reversable layout doesn't seem great either.

    I think I would like to come up with a name that is not layout-specific, alias flex-* to that, and keep start/end/self-start/self-end purely based on writing mode.

  4. celestepan commented on Jun 16, 2026

    @celestepan
    ContributorAuthor

    @Loirooriol It sounds like we're in agreement to keep start and end consistent with writing mode -- so start would be the top of the container in column layout and left of the container in row layout.

    I also agree that we don't want to be adding new keywords for each reversable layout.

    Can you elaborate on what you mean about coming up with a name? What were you thinking to use that new name for?

  5. Loirooriol commented on Jun 17, 2026

    @Loirooriol
    Contributor

    I was thinking that e.g. align-self: something-start would:

    • In flex layout with flex-wrap: wrap-reverse, behave like end
    • In waterfall grid lanes layout with fill-reverse, behave like end
    • I'm not sure if we resolved to add a reversal mechanism for plain grids, if so, analogous
    • Otherwise, behave like start

    And flex-start would become an alias of something-start.

  6. celestepan commented on Jun 18, 2026

    @celestepan
    ContributorAuthor

    Thank you for clarifying!

    Given that flex-start is technically defined for non-flex containers as well, what are your thoughts on just re-using flex-start/end in grid-lanes and having that have the same behavior that you outline:

    • In flex layout with flex-wrap: wrap-reverse, behave like end
    • In waterfall grid lanes layout with fill-reverse, behave like end
    • I'm not sure if we resolved to add a reversal mechanism for plain grids, if so, analogous
    • Otherwise, behave like start
  7. alisonmaher commented on Jun 18, 2026

    @alisonmaher
    Collaborator

    Per spec, flex-start is supposed to work like start in everything but flex (see https://drafts.csswg.org/css-align-3/#positional-values) so I think whatever we decide should happen for start in grid lanes with fill-reverse, flex-start should match that (regardless of what flex-start does with reversals in flexbox).

  8. Loirooriol commented on Jun 18, 2026

    @Loirooriol
    Contributor

    what are your thoughts on just re-using flex-start/end in grid-lanes

    I think it would be too confusing to let flex-start differ from start on layouts other than flex.

  9. 9 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址