Free guideThe newsletter. Real UI fixes by email, and a free 35-page guide to AI design skills.
Ship Better UI

, 1 minute 9 seconds

How do you make headings resize smoothly across screen sizes?

The rule

Size a heading with clamp(), not a breakpoint: a 39 px floor, a 61 px ceiling and a preferred size that adds 2.39vw, so it grows smoothly from 39 px on a 360 px screen to 61 px at 1280 px.

Try it

Apply the fix

Prompt for your AI coding tool

Paste it into Claude Code, Cursor or any AI coding tool, then share the page you want fixed.

Review the headings in the interface I share. Replace any heading size that jumps at a breakpoint with one fluid size. Fix what fails, and change nothing else.

1. Floor: the smallest size the heading should have on a small screen. In the video's example, 39 px, written as 2.44rem.
2. Ceiling: the largest size it should reach on a big screen. In the example, 61 px, written as 3.81rem.
3. Preferred size: a rem value plus a vw value (1vw is 1% of the window's width), so the heading grows as the window grows. In the example, 1.9rem + 2.39vw takes it from 39 px on a 360 px screen to 61 px at 1280 px.
4. Write it as one line, font-size: clamp(floor, preferred, ceiling), for example font-size: clamp(2.44rem, 1.9rem + 2.39vw, 3.81rem), and remove the breakpoint rules that set the same heading's size.

Keep the content, the words and the layout. When you are done, list each heading you changed with its old sizes and its new clamp().

More prompts like this in the free guide 

The problem

The landing page in the video sizes its heading with one breakpoint. Below 768 px wide it is set to 39 px. At 768 it jumps straight to 61 px: 22 px bigger in one pixel of window width. A screen a little under the line gets the small heading, and one a little over gets the big one.

The fix

Replace the breakpoint with one line of CSS: font-size: clamp(2.44rem, 1.9rem + 2.39vw, 3.81rem). You give clamp() three sizes.

  1. Smallest. 2.44rem is the floor: 39 px.
  2. Preferred. 1.9rem + 2.39vw grows with the window. 1vw is 1% of the window's width.
  3. Largest. 3.81rem is the ceiling: 61 px.

Why it works

clamp() uses the preferred size while it sits between the other two, and stops at the floor or the ceiling when it would pass them. The preferred size adds 2.39% of the window's width, so the heading grows as the window grows. Drag the same window and the heading grows smoothly from 39 px on a 360 px screen to 61 px at 1280 px, with no jump anywhere. Narrower than 360 it holds at 39, and wider than 1280 it holds at 61.

How to apply it

Pick the heading's smallest and largest sizes, and the narrowest and widest screens they belong to. Write the two sizes in rem as the floor and the ceiling. The vw part is the size change over the width change: 22 px over 920 px is 2.39vw. The rem part makes the line start at the floor. Then drag your window from narrow to wide: the heading should grow without a single jump, and stop at both ends.

Free guide · 35 pages

Get fixes like this by email

Join the newsletter and get the 35-page guide to AI design skills: the skills, the order to use them in, and prompts to copy.

Watch it on

More on type

All 6 lessons on type