Combining full width with a maximum creates a panel that scales to its parent. Automatic margins can centre it after it reaches the cap.
Worked example
<div class="demo w-[min(100%,20rem)]">Fluid width with a maximum</div>Implementation notes
The maximum applies to the element, while outer gutters usually belong to its parent. Avoid charging the same horizontal padding twice.
Try it yourself
Resize the parent independently from the browser.
Open the Tailwind CSS example →Editorial date August 12, 2025 · Published December 6, 2026