Use clamp() to let a font size grow or shrink with the viewport while keeping it within chosen limits: font-size: clamp(1rem, 2.5vw, 2rem); The first value is the minimum, the middle value is the preferred fluid size, and the last is the maximum. Choose bounds for your design, then test the finished page with text enlarged to 200%.
How clamp() makes a font size fluid
The CSS clamp(min, preferred, max) function compares three expressions. The preferred value is used while it falls between the lower and upper bounds; below that range the minimum applies, and above it the maximum applies. In effect, it resolves to max(min, min(preferred, max)). See MDN’s clamp() reference.
In 2.5vw, the number is a percentage of the viewport width. As the viewport grows, that preferred font size grows too. The rem bounds keep it from shrinking or growing without limit. MDN’s representative declaration is:
font-size: clamp(1rem, 2.5vw, 2rem);
1remis the minimum font size.2.5vwis the viewport-responsive preferred size.2remis the maximum font size.
The values are examples, not universal recommendations. Set the minimum and maximum according to the text’s role and the narrowest and widest reading contexts you support. A heading may need different bounds from body copy.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
Write and tune a bounded rule
- Choose the lower and upper bounds. Express them in scalable units such as
rem, and select sizes that remain readable for the intended content. - Choose a fluid middle value. A viewport unit such as
vwties the preferred size to viewport width. For example, start with2.5vwand check the result at the narrow and wide ends of your layout. - Put the values in minimum, preferred, maximum order. For example:
font-size: clamp(1rem, 2.5vw, 2rem); - Adjust based on the rendered text. If the preferred size reaches a bound too early or too late for your design, revise the values and recheck the actual content.
This lets one font-size rule vary continuously with viewport width without a media query. It does not replace breakpoints where the design needs a discrete change, such as a different layout or a distinct typographic treatment.
Keep text resizing effective
When clamp() controls text, MDN advises using a relative maximum that is at least twice the relative minimum. Its example, clamp(1rem, 2.5vw, 2rem), follows that guidance. This helps text scale when a page is zoomed, but the formula alone does not prove that a page meets accessibility requirements.
WCAG 2.2 Success Criterion 1.4.4 says: “Except for captions and images of text, text can be resized without assistive technology up to 200 percent without loss of content or functionality.” Read the W3C explanation of Resize Text. The W3C also identifies incorrect use of viewport units to resize text as a common failure. Viewport-relative sizing must not prevent users from enlarging text.
Make the 200% check part of implementation
- Check representative pages at 200% text size or zoom, as appropriate to the browser and test setup.
- Inspect headings, paragraphs, navigation, buttons, form controls, and any other content affected by the rule.
- Look for text that is clipped, truncated, overlapped, or obscured, and for controls or content that become unavailable.
- Fix the layout or sizing and repeat the check with the real content—not only short sample strings.
Passing this visual check is not a substitute for evaluating the page against WCAG, but it can reveal common problems introduced by constrained dimensions or viewport-based sizing.
Rank #3
When to use a fixed size, breakpoints, or clamp()
| Approach | How size changes | Bounds | What to check |
|---|---|---|---|
Fixed font-size |
Stays at one declared size across viewport widths. | No fluid range unless additional rules define one. | Check readability and user resizing across the layouts you support. |
| Media-query sizing | Changes at specified breakpoints, typically in discrete steps. | Set by the values declared in each rule. | Check the breakpoints and the ranges between them, as well as enlarged text. |
Fluid clamp() sizing |
Changes continuously while the preferred value is between its bounds. | The minimum and maximum are explicit arguments. | Check narrow and wide contexts, and confirm text remains resizable without loss. |
These approaches can also be combined: a fluid size can handle gradual scaling while media queries handle a genuine change in design. Choose based on the content and layout rather than assuming one formula fits every element.
Browser availability
MDN labels clamp() Baseline and widely available, reporting support across browsers since July 2020. For exact browser-version details, consult the current compatibility table in MDN’s reference.
Rank #4
Or skip the browser setup
If you also need screenshots of a page to review its layout, ScreenshotNeo is a website screenshot API and MCP server. A screenshot does not replace checking text enlargement in the browser. One GET request can return a screenshot; see the API documentation.
Quick Recap
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture. Bot checks, blank pages, failed loads, and cache hits are not billed. Its MCP server lets AI agents take screenshots, and its Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteProduct prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




