Web features explorer

fit-content

Widely available since 2024-05-02
Tags: css Groups: CSS > Layout

The fit-content CSS keyword expands a box as needed to fit its contents until the maximum size is reached, preserving the content's preferred aspect ratio.

Learning resources on MDN

Browser support