w3c / w3c/csswg-drafts

[css-grid] More granular auto placement from grid container element

Open
#7,399 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

css-grid-3
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

https://www.w3.org/TR/css-grid-1/#track-sizing-algorithm

In a many cases, you can rely on the default placement of the grid to do what you want. However, in the cases that it isn’t, you currently have to define grid-area (or other) on the children elements, which seems like a lot of extra ceremony.

Firstly, it would be nice if grid-auto-flow could be extended to allow named grid areas before row/column to populate these areas first.

grid: "a b c" auto / auto auto auto;
grid-auto-flow: b c a;

And this should also work on the grid property itself.

grid: "a b c" auto / auto auto auto b c a;

Presumably, if any children had explicit grid areas, they would be excluded from the auto placement. It’s probably an edge case anyway.

Secondly, it would be nice to add {row,column}-reverse to grid-auto-flow, to match flex-direction - where it will fill items in from the end rather than the start

grid-auto-flow: row-reverse;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CSS Grid Level 1 track sizing algorithm and the existing definitions of grid-auto-flow and grid. Determine how named-area ordering and row/column reverse placement should interact with explicit grid areas and the grid shorthand. Done means the specification resolves these proposed behaviors and their edge cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.