Page MenuHomePhabricator

Support "width: fit-content" in TemplateStyles/Sanitized CSS
Open, Needs TriagePublic

Description

The fit-content keyword for the CSS width property is currently defined in the CSS Box Sizing Module Level 4 Editor's Draft, but it is based on the fit-content() definition from the CSS Box Sizing Module Level 3 Working Draft (both of which are standards track).

The change between them is simply from a CSS function to a keyword, but both do the same thing: they invoke the user agent's native content-width calculation. And the reason for the deferment from Level 3 to Level 4 was the overall design of "intrinsic sizing" (of which fit-content is a part) rather than significant changes to fit-content itself.

width: fit-content is well supported by all modern browsers (minus IE). Most browsers added support for this in the 2015–2017 timeframe, including Firefox, but Firefox still needs the -moz- prefix. In other words: it's still just a bit early to use in MediaWiki core or default skins, but plenty mature enough in controlled and limited use cases like TemplateStyles.