Use Cases For CSS fit-content
The keyword fit-content
will make an element width
equal to its content based on specific conditions.
It checks if the available is more than
max-content
, then the width is equal to
max-content
. If the available space is less than
max-content
, then the width will be equal to the
available space. Finally, if the available space
is less than min-content
, then the width will be
equal to min-content
.
.fit-content {
width: fit-content;
}