A fluid container needs a small-screen width and a large-screen maximum. Outer gutters should remain visible at both extremes.
Worked example
<style>
.demo {
width: min(100%, 20rem);
}
</style>
<div class="demo">Fluid width with a maximum</div>Implementation notes
Maximum width does not centre a container by itself. Inspect the remaining inline space and decide which margins should absorb it.
Try it yourself
Check a width slightly below the maximum and one well above it.
Open the CSS example →Editorial date December 4, 2026 · Published December 6, 2026