w3c / w3c/csswg-drafts

[css-grid] Removing grid-items from layout calculations in one direction, especially for `auto-fit`

Open
#3,271 2 comments 0 reactions 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

Spec: https://www.w3.org/TR/css-grid-1/#auto-repeat
Codepen: https://codepen.io/pmccloghrylaing/full/PBJNKG/

I raised an issue previously (#2956) about creating a tabbed layout where the tabs were positioned using auto-fit (so they always take up the full width), and the tab panel takes up the full width (using grid-column: 1 / -1). This ended up behaving exactly like auto-fill. One of the advantages of this approach is it falls back to an accordion.

The solution I ended up using was to applying position: absolute to the tab panel so it didn't affect the layout calculations for auto-fit. That worked in my particular case because the tab panel was a fixed height with overflow: auto, but what I would have preferred is a solution that allowed you to define that a grid item occupied particular columns (or rows) but shouldn't be used in layout calculations in that direction, especially for auto-fit.

This could tie in with #2402

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 CSS Grid Level 1 auto-repeat section and the linked CodePen, then compare the earlier issue #2956 and related issue #2402. Determine whether the requested directional exclusion for grid-item layout calculations can be specified; done requires a resolved proposal or specification direction from the CSS Working Group.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.