min/max/fit-content Playground

Mr. Karim’s signboard rack: your words cut by every rule at once, auto, min-content, max-content, fit-content and grid tracks, and the browser measures each…

Why it matters

Chips, badges and buttons that fit their text, with no hardcoded number that breaks when the text gets translated. It is also the key to mysterious horizontal scroll: there is almost always content whose min-content is wider than its parent (a URL, a long word, nowrap), and 1fr or a flex item refuses to shrink below it.

The key idea

The browser measures two numbers from the content: min-content and max-content. Every keyword is a rule on those two numbers.

Common mistakes

Try it in this playground