In CSS what is the difference between "width: fit-content;" and "width: "fit-content(some_value);"?

Viewed 400
1 Answers

You need to refer to the specification to find them:

Value: auto | | min-content | max-content | fit-content(<length-percentage>)

This is the Box Sizing Level 3 specification.

Later in the Level 4 you can read:

New values: stretch | fit-content | contain

And

fit-content

Essentially fit-content(stretch) i.e. min(max-content, max(min-content, stretch)).

So fit-content = fit-content(stretch)

stretch

Applies stretch-fit sizing, attempting to match the size of the box’s margin box to the size of its containing block. See § 7.1 Stretch-fit Sizing: filling the containing block.

Related