Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-sizing] Proposal: default-width CSS property #10282

Open
benface opened this issue May 6, 2024 · 1 comment
Open

[css-sizing] Proposal: default-width CSS property #10282

benface opened this issue May 6, 2024 · 1 comment

Comments

@benface
Copy link

benface commented May 6, 2024

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 #3226 (comment)

@benface
Copy link
Author

benface commented Jul 15, 2024

  • stretches properly when placed in a grid layout with justify-items: stretch, without any contextual override (i.e. no &:is(.grid > *) { width: auto; })

Note: this is also a problem with a column flex container (with the default align-items which stretches items horizontally).

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

No branches or pull requests

2 participants