Skip to content
Astera Technology

Bound fluid type between two endpoints

Measure clamp(20px,4vw,36px) at three viewport widths.

Computed size is20px at320,24px at600 and 36px at 960.

Download complete case notes and answer keys ↓

Inspect the working example

The heading uses a preferred 4vw size between 20px and 36px. These are original demonstration values; measured size alone is not a readability or accessibility certification.

Inputs and native observations
CaseInput or inspectionResult and meaning
Narrow4% of320=12.8Clamped to20px minimum
Middle4% of600=24Preferred 24px lies inside the range
Wide4% of960=38.4Clamped to36px maximum
Download editable CSV ↓

Follow the browser mechanism

clamp chooses the preferred expression within the supplied bounds. The formula here uses pixels and viewport units, so changing the root rem size is not itself a complete font-enlargement test for this heading. The proof separately enlarges rendered text and checks reflow.

A fluid formula alone has no endpoint limits

The alternative removes clamp and uses 4vw directly.

Counterexample source; inspect separately
<style>body{margin:8px}</style>
<style>h2{font-size:4vw}</style><h2>Workshop notes</h2>

It computes to12.8px at320 and 38.4px at 960, outside the chosen 20–36px demonstration bounds.

Try the repair

At a750px viewport, which size does the working expression choose?

Show the worked answer

30px: 4vw is30px and lies between 20 and 36.

  • Read computed font-size; do not estimate from screenshots.
  • Test enlarged rendered text as well as the original formula.

Original example files

Related resources