w3c / w3c/csswg-drafts

[css-sizing] Proposal: `default-width` CSS property

Open
#10,282 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-sizing-4
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

The problem

It is impossible to write a CSS component that:

  • has a default width, whether it's a fixed width or a keyword other than auto (e.g. 200px or fit-content)
  • stretches properly when placed in a grid layout with justify-items: stretch, without any contextual override (i.e. no &:is(.grid > *) { width: auto; })
The solution

A new default-width property that defines the width of a width: auto element, while allowing it to stretch in a grid context.

Here's a Codepen that has a good visual explanation.

Related to #7427, and could fix https://github.com/w3c/csswg-drafts/issues/3226#issuecomment-1222926779

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 problem and proposed default-width behavior in this issue, then review the linked CodePen and related issues #7427 and CSSWG issue #3226. Done would require resolving the proposal and documenting the agreed CSS property behavior in the relevant CSS Sizing specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend, web-dev
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.