fit-content
Widely available since 2024-05-02
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
- Chrome 46 Released on 2015-10-13
- Chrome Android 46 Released on 2015-10-14
- Edge 79 Released on 2020-01-15
- Firefox 94 Released on 2021-11-02
- Firefox for Android 94 Released on 2021-11-02
- Safari 11 Released on 2017-09-19
- Safari on iOS 11 Released on 2017-09-19