Web platform 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.

Learn more

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