Open benface opened 5 months ago
- 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).
The problem
It is impossible to write a CSS component that:
auto
(e.g.200px
orfit-content
)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 awidth: 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