Font Sizes That Scale With the Screen in Divi 5 (clamp() Explained)

by | Nov 20, 2026 | Divi

Divi 5 can make text grow smoothly from a phone to a desktop instead of jumping between fixed sizes at each breakpoint. It does it with the CSS clamp() function, either typed into a Text Size field or generated for you by the Variable Generator in the Variable Manager. On a site with Divi’s standard 1080px rows, the generator’s defaults take body text from 16px on a 360px phone to 18px on any screen 1350px or wider, and the largest heading size goes from about 29px to 55px.

This post explains what a clamp() value means, what the Divi responsive font size settings in the generator actually produce, how to write one yourself, and the zoom check that fluid text needs.

⚡ The short answer

  • A clamp() font size has three parts: the smallest size, a size that grows with the screen, and the largest size.
  • In Divi 5, open the Variable Manager, hover over Numbers and choose Generate Fluid Sizing Variables. Pick Font Size and the Fluid Scale (CSS Clamp) type.
  • The text grows from a 360px screen up to the width where your rows stop getting wider. The generator works that out from your site’s content width: with Divi’s standard 1080px rows at 80% it’s 1350px.
  • Keep the minimum and maximum in rem, so the text still follows a visitor’s own font size setting.
  • Keep the largest size no more than 2.5 times the smallest. Then a visitor can always zoom the text to double its size.

📐 What clamp() does

clamp() takes three values:

font-size: clamp(smallest, preferred, largest);

The browser uses the preferred value unless it falls below the smallest or above the largest, in which case it uses that limit. For text that scales with the screen, the preferred value includes vw. One vw is 1% of the width of the browser window, so on a 400px phone 1vw is 4px and on a 1400px laptop it’s 14px.

Here is Divi’s default body size from the generator:

clamp(1rem, calc(0.00202 * (100vw - 360px) + 16px), 1.125rem)

Read from the middle: start at 16px on a 360px screen and add 0.00202px for every extra pixel of screen width. On a 1350px screen that adds 2px, giving 18px. The 1rem and 1.125rem limits (16px and 18px) stop it going smaller on a narrower phone or larger on a wide monitor.

Screen widthBody size (text-m)Largest heading size (text-4xl)
320px16px28.8px
360px16px28.8px
768px16.8px39.6px
1024px17.3px46.3px
1350px18px54.9px
1920px18px54.9px
Divi responsive font size with the default fluid settings: body text rises from 16px to 18px and the largest heading from 28.8px to 54.9px between 360px and 1350px screens.
How the default body and largest heading sizes change with screen width.

Body text barely changes: 2px across the whole range. Large headings change a lot, and they’re where fluid sizes help most. A 55px heading that suits a laptop wraps onto four or five lines on a phone, while a size that suits a phone looks timid on a wide screen.

🧮 Divi responsive font size with the Variable Generator

The Variable Generator arrived in Divi 5 at the end of April 2026. It writes a whole set of font sizes at once and saves them as global variables, so you set them up once and use them on any module.

  1. Open a page in the Visual Builder and click the Variable Manager icon in the left sidebar.
  2. Hover over the Numbers group and click the small icon that appears at the right of the row (Generate Fluid Sizing Variables).
  3. In the Variable Generator, choose Font Size as the Variable Type and Fluid Scale (CSS Clamp) as the Scale Type.
  4. Check the settings below. Show CSS shows the clamp() value for each size.
  5. Click Add Variables To My Site, then Save Variables at the bottom of the Variable Manager.

These are the font size defaults in Divi 5.19.1:

SettingDefaultWhat it controls
Variable Prefixtext-The start of each name: –text-s, –text-m and so on
Base SizemWhich size is the body size
Generated CSS Unitsrem (1rem = 16px)The unit used for the smallest and largest sizes
Base Min. Font Size (Phone)16pxBody size on the narrowest screen
Base Max. Font Size (Desktop)18pxBody size once the row reaches full width
Min. Font Size Scale (Phone)1.125How much bigger each step is on phones
Max. Font Size Scale (Desktop)1.25How much bigger each step is on desktops
Viewport Lower Limit (px)360Below this width, sizes stay at their smallest
Desktop Row Width (%)Your site’s row width (80% on a standard site)Used to work out where growth stops
Desktop Row Max-Width (px)Your site’s content width (1080 on a standard site)Growth stops at max-width ÷ row width: 1080 ÷ 0.8 = 1350px

The two row settings are filled in from your own site: the Website Content Width in the Theme Customizer, or your default Row preset if it sets a width. On my test site, with 1281px rows, the text kept growing up to a 1601px screen. Check those two fields match the rows you actually use.

The Divi 5 Variable Generator set to Font Size and Fluid Scale (CSS Clamp), showing Divi responsive font size defaults from text-xs to text-4xl.
The Variable Generator with its default font size settings.

The default set has eight sizes, from text-xs to text-4xl, with text-m as the body size. Using a smaller scale on phones (1.125) than on desktops (1.25) keeps headings from getting too big on a narrow screen. The steps are closer together on a phone and spread out on a desktop.

One thing to look at before you click Add: with these defaults, text-xs comes out at 12.6px on a phone and 11.5px on a desktop, so it gets slightly smaller as the screen gets wider. It’s the only default size that does. If you plan to use it for captions or small print, raise the base sizes or don’t use text-xs for anything people need to read.

To use a size, open a Text module and go to Design → Text. Hover over Text Text Size, click the Dynamic Content icon above the field and pick the size from My Global Numbers. Elegant Themes also suggests building Option Group Presets from the variables, so a heading style or body style carries its size wherever you use it.

✍️ Writing your own clamp() value

You don’t need the generator to use clamp(). Divi 5 accepts CSS functions in its size fields, so you can type a value straight into Text Text Size. The field shows the three values with “clamp” where the unit usually sits, and Divi writes it into the page’s CSS as it is.

To work one out, you need four numbers: the smallest size and the screen width where it applies, and the largest size and the screen width where it applies. Then:

  1. Growth per pixel: (largest size − smallest size) ÷ (wide screen − narrow screen).
  2. Starting value: smallest size − (growth per pixel × narrow screen).
  3. The vw part: growth per pixel × 100.

For 16px at 360px rising to 18px at 1350px:

  1. (18 − 16) ÷ (1350 − 360) = 0.00202
  2. 16 − (0.00202 × 360) = 15.27px, which is 0.9545rem
  3. 0.00202 × 100 = 0.202vw
font-size: clamp(1rem, 0.9545rem + 0.202vw, 1.125rem);

Check the result at both ends: at 360px, 0.202vw is 0.73px, and 15.27 + 0.73 = 16px. At 1350px it’s 2.73px, giving 18px. On my test page Chrome measured 16px at 360px, 17.3px at 1024px and 18px at 1350px. Some guides start the preferred value at half the smallest size. That only gives the right answer for particular numbers, so work out step 2 each time.

A clamp() value typed into the Text Text Size field of a Divi 5 Text module.
A clamp() value in Text Text Size.

🔍 The zoom check

Browser zoom makes rem and px values bigger but doesn’t change what 1vw is worth in screen pixels, because zooming also makes the page narrower in CSS pixels. So the vw part of a fluid size shrinks as you zoom in, and fluid text grows more slowly than the zoom level.

I worked this out for Divi’s defaults on a 1440px laptop screen:

ZoomBody (text-m)Largest heading (text-4xl)
100%18px54.9px
200%33.5px (1.86 times)76.6px (1.40 times)
300%48.7px (2.71 times)96px (1.75 times)
400%64px (3.56 times)115.3px (2.10 times)
500%80px (4.44 times)144.2px (2.62 times)

WCAG’s success criterion 1.4.4 asks that text can be resized to 200% without losing content. It doesn’t have to happen at exactly 200% zoom, and browsers zoom to 500%. Maxwell Barvian worked out that if the largest size is no more than 2.5 times the smallest, the text always reaches double size somewhere in that range. Every one of Divi’s default sizes passes: the biggest ratio is text-4xl’s, at 1.91.

If you write your own, divide the largest size by the smallest. A heading that goes from 20px to 64px (3.2 times) can fail. Raise the smallest size or lower the largest.

Keep the smallest and largest values in rem. If a visitor sets their browser’s default text size to 20px, a 1rem minimum becomes 20px and the text gets bigger. A px minimum ignores that setting.

↕️ Fluid sizes or Divi’s responsive values?

Divi has always let you set a different size for tablet and phone with the Edit responsive values icon on a field. That gives you exact sizes at each breakpoint, and the text jumps from one to the next as the screen narrows. Fluid sizes fill the gaps between.

  • Body text: either works. Going from 16px to 18px is a small change, and a phone size and desktop size set as responsive values do the same job.
  • Large headings: fluid sizes are better. A tablet held sideways or a small laptop gets an in-between size instead of the phone or desktop size.
  • A site with only a few pages: responsive values are simpler to check, because there are only three sizes to look at.

Line height needs a look too. A heading set to 1.2 at 55px has lines about 66px apart. At 29px on a phone it still looks right, because the line height is a multiple of the text size and scales with it. Use a number or em for line height, not px.

🚫 What fluid sizes don’t fix

They don’t decide what your sizes should be. A heading scale that’s too tight or too spread out looks wrong at every screen width. Choosing heading sizes is next week’s post. They also don’t control line length: if text grows on a wide screen, check the Max Width on your Text modules still gives 45 to 75 characters a line, as in the readable body text post.

The Variable Generator is a Divi 5 feature. Divi 4 has the responsive values but not the generator. Divi 5 is a free update for anyone with a Divi membership.

And if you’d rather someone else set it up, I build and look after Divi sites for small businesses. Have a look at my web design service.

❓ Frequently asked questions

How do I make font size responsive in Divi 5?

Either set a separate size for tablet and phone with the Edit responsive values icon on the Text Size field, or use a clamp() value so the size changes smoothly with the screen width. Divi 5’s Variable Generator writes a set of clamp() sizes for you.

Where is the Variable Generator in Divi 5?

In the Visual Builder, open the Variable Manager from the left sidebar, hover over the Numbers group and click Generate Fluid Sizing Variables.

What does clamp() mean in CSS?

It sets a value that stays between a minimum and a maximum. For font sizes the middle value usually includes vw, so the text grows with the width of the screen until it reaches the maximum.

At what screen width does Divi’s fluid text stop growing?

On a site with Divi’s standard rows, at 1350px: the 1080px maximum row width divided by the 80% row width. The generator fills in your own site’s row width, so check Desktop Row Width and Desktop Row Max-Width before you add the sizes.

Is fluid typography bad for accessibility?

Not if it’s set up carefully. Keep the minimum and maximum in rem, and keep the largest size no more than 2.5 times the smallest so visitors can still zoom text to double its size.

Sources

Checked on 20 November 2026.

This post contains affiliate links to Elegant Themes. If you buy through them I may earn a commission, at no extra cost to you.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Affiliate Link
Divi Marketplace

Divi Marketplace

GreenOrb Statistics plugin

“Disclosure: Some of the links in this post are “affiliate links.” This means if you click on the link and purchase the item, I will receive a small affiliate commission.”

Pin It on Pinterest