Contact emails
j...@chromium.org
Explainer
No information provided
Specification
https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content
Summary
Implements the fit-content(<length-percentage>) value for width, height, min-width, max-width, min-height, and max-height properties as defined by the CSS Box Sizing Module Level 3.
It resolves as min(max-content, max(min-content, <length-percentage>)), clamping an element's size between its min-content and max-content while targeting the specified length or percentage.
This gives developers explicit control over content-based sizing without relying on the available space, unlike the fit-content keyword which always uses the stretch size as its target.
Blink component
Blink>CSS
Web Feature ID
fit-content-function
Motivation
The fit-content keyword exists but always clamps against the available space. When developers need to clamp an element's size between its min-content and max-content using a specific length or percentage instead of the available space, there is no CSS-native way to express this.
Initial public proposal
https://drafts.csswg.org/css-sizing-3/#funcdef-width-fit-content
Goals for experimentation
None
Requires code in //chrome?
False
Tracking bug
https://issues.chromium.org/issues/40847362
Estimated milestones
No milestones specified
Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5173684820115456?gate=4535388490301440