Responsive design settings are classically tied to three central breakpoints: tablet, mobile, and desktop. It’s a pattern that worked well back when devices followed predictable screen categories, but today it may feel outdated. The reason is that we are now dealing with foldable phones, 4K laptops, and ultrawide monitors; the gap between those three breakpoints has expanded significantly.
Modern web design, including WordPress development, now demands layouts that respond fluidly to any screen size, not just specific ones. So, instead of snapping from one breakpoint to another, elements should scale smoothly, adapting to every pixel in between. This is exactly where fluid CSS and functions like calc() and clamp() come in, providing fine-grained, mathematical control over how your designs behave across all viewports.
What Is Fluid CSS?
Fluid CSS is a design approach where elements scale continuously with the viewport, without relying on hard breakpoints or multiple media queries.
- This is the logic behind using breakpoints:
- At 768px and above, set the font to 18px; and starting at 1200px, set it to 26px.
- And this is the logic behind fluid CSS:
- Scale the font naturally between 18px and 26px as the screen grows.
It’s not new, as the concept dates back to early “liquid layouts” of the 2000s. However, at that time, CSS lacked the tools to achieve smooth and controlled fluid scaling.
Developers had to hack it with percentages or JavaScript-based resizing scripts.
The real turning point came around 2019–2020, when major browsers (Chrome, Firefox, Safari, Edge) fully adopted CSS mathematical functions like calc() and the newer clamp() (introduced in the CSS Values and Units Level 4 specification).
That’s when fluid typography and fluid spacing became mainstream, and CSS could finally scale between values smoothly, without scripts or complicated media queries.
Understanding calc() in CSS
The calc() function gives CSS mathematical superpowers. It lets you mix units, including pixels, percentages, rem, and vw, to calculate dynamic values directly in your stylesheet.
For example:
.main-content {
width: calc(100% - 300px);
}Here, you’re telling the browser to take the full container width and subtract 300 pixels for the sidebar.
That’s particularly handy in WordPress layouts that combine flexible sections (like content areas) and fixed ones (like sidebars or widgets).
You can use calc() in:
- block padding and margins;
- container widths and heights;
- position adjustments in headers or sticky elements;
- custom theme layouts mixing px and %.
Common mistake: calc() requires spaces around operators.
✅ calc(100% – 20px)
❌ calc(100%-20px)
Understanding clamp() in CSS
If calc() is about relationships, clamp() is about boundaries. It defines a value that scales between a minimum and maximum limit, using a fluid formula in the middle.
Syntax:
property: clamp(min, preferred, max);
For example:
h1 {
font-size: clamp(1.5rem, 2vw + 1rem, 3rem);
}Here, you are telling never go smaller than 1.5rem, scale up using 2vw + 1rem as the flexible formula, but never exceed 3rem.
You don’t have to use a flexible formula in between (it just adds more flexibility); it can be something like clamp(1.5em, 2em, 3rem).
As the viewport width increases, your heading size also grows, but within natural limits.
That’s what we mean by fluid typography.
But my favorite usage of clamp() is for spacing. While many WordPress builders already handle basic responsiveness automatically, e.g., automatically stacking horizontal layouts into vertical ones on mobile, spacing between blocks or screen borders and containers is a pain point.
So, if I want to use breakpoints to fix this issue, I should set different spacing (paddings, margins) for each possible screen size separately. But if I use clamp(), I just need to set it once.
calc() vs. clamp(): When to Use Each
It might be confusing, so let’s break down when to use each method.
| Purpose | calc() | clamp() | Example |
| Compute a value from multiple measurements | ✅ Designed for this. You can add, subtract, multiply, or divide any mix of units (%, px, vw, rem). | ❌ Not designed for this. Each argument is a single value, though you can use math inside it. | width: calc(100% – 300px); |
| Set a value that can grow or shrink within limits | ❌ No concept of minimum or maximum. It always outputs one fixed number. | ✅ Purpose-built for this: clamp(min, preferred, max) defines a scaling range. | font-size: clamp(1rem, 2vw + 1rem, 2rem); |
| Define proportional relationships between layout parts (e.g., content + sidebar) | ✅ Perfect for this. Great for widths, offsets, and gaps. | ❌ Not suitable – it doesn’t compare one element’s size to another. | grid-template-columns: 1fr calc(100% – 300px); |
| Make typography or spacing scale fluidly with screen size | ⚠️ Possible but cumbersome – needs multiple media queries or viewport math. | ✅ Ideal – defines smooth scaling with clear limits. | padding: clamp(1rem, 2vw, 3rem); |
| Use arithmetic inside the value (e.g., 2vw + 1rem) | ✅ Yes, fully. | ✅ Yes, but only inside one of the three arguments. | clamp(1rem, 2vw + 1rem, 2.5rem); |
| Best use cases | Layout structure: columns, container widths, offsets. | Fluid design: typography, paddings, margins. |
Also, you can insert calc() inside clamp(), e.g.:
padding: clamp(1rem, calc(1vw + 0.5rem), 2.5rem);NOTE
However, don’t overuse complex constructs like this, as it can hurt performance because each calc() and clamp() expression requires runtime computation by the browser. These values aren’t precomputed like static CSS – they’re recalculated on every viewport resize, zoom change, or layout reflow.
Major Page Builders Support
Here’s how modern builders handle calc() and clamp():
| Builder | Supports calc() | Supports clamp() | Notes |
| Elementor | ✅ Yes | ✅ Yes | Works directly in numeric fields (font size, padding, margin). |
| Bricks Builder | ✅ Yes | ✅ Yes | Fully compatible; also supports nesting and CSS variables. |
| Divi | ✅ Partial | ✅ Partial | Works in “Custom CSS” fields and some numeric inputs. |
| WPBakery | ✅ Yes | ⚠️ Limited | Add via custom class or inline CSS; interface fields don’t parse functions reliably. |
| Oxygen | ✅ Yes | ✅ Yes | Works in Advanced CSS; use variables for consistency. |
| Kadence Blocks | ✅ Yes | ✅ Yes | Gutenberg-based; supports clamp() in global typography and spacing controls. |
| GenerateBlocks | ✅ Yes | ✅ Yes | Also uses these functions inside the responsive typography settings. |
| Breakdance | ✅ Yes | ✅ Yes | Focused on fluid scaling out of the box. |
| Cwicly | ✅ Yes | ✅ Yes | Fully supports CSS math and variables in visual inputs. |
Using CSS variables for consistency
To make your site scalable and easy to maintain, define fluid values as CSS variables. First, define them, and then you can use them as needed. For example:
:root {
--fluid-gap: clamp(1rem, 2vw, 2.5rem);
--fluid-font: clamp(1rem, 1.2vw + 0.5rem, 1.8rem);
--sidebar-width: 300px;
}
.content {
padding: var(--fluid-gap);
font-size: var(--fluid-font);
width: calc(100% - var(--sidebar-width));
}Fluid CSS and Crocoblock plugins
While Crocoblock is all about dynamic content, it’s quite smart and logical to use a dynamic CSS approach when building any template. Especially when the content is dynamic, you can’t predict the size of each element or how it will behave in different contexts.
For example, a product card in JetWooBuilder might have one or three lines of title text, or a Listing item built with JetEngine might contain images of different proportions. Additionally, the Components feature or Custom Post Type (CPT) templates would greatly benefit from such an approach, as relying solely on fixed spacing can cause the layout to break or appear uneven.
Common Mistakes to Avoid
Although calc() and clamp() may appear simple, even a few small errors can cause unexpected behavior. Here’s what to watch out for:
- Forgetting spaces in calc().
calc() requires spaces around the +, -, *, and / operators. Without them, the rule won’t work.
❌ width: calc(100%-20px);
✅ width: calc(100% – 20px); - Using unrealistic clamp() ranges.
If the min and max values are too far apart, elements will scale too aggressively.
❌ font-size: clamp(1rem, 10vw, 5rem); (text jumps wildly between devices)
✅ font-size: clamp(1rem, 2vw + 1rem, 2.5rem); (smooth, controlled scaling) - Mixing inconsistent units.
Some units scale differently. For example, vh changes with screen height, while em changes with font size.
❌ padding: calc(2vh + 1em);
✅ Use consistent types: padding: calc(2vw + 1rem); - Ignoring accessibility settings.
If your text sizing relies only on viewport width, it might ignore user zoom or OS-level scaling.
✅ Always include rem or em in your clamp() formula, not just vw:
font-size: clamp(1rem, 1.5vw + 0.5rem, 2rem); - Testing only in the browser preview and not testing properly.
Fluid CSS may look perfect in the browser preview, but behaves differently on real devices.
✅ Always check your layout on actual phones, tablets, and monitors; some mobile browsers round decimals or scale viewport units differently.
FAQ
Fluid CSS is a responsive design technique where elements scale continuously with the viewport size, rather than jumping between fixed breakpoints. It creates smoother, more natural responsiveness across all devices.
calc() lets you combine different CSS units dynamically, while clamp() defines a value range that grows fluidly within set limits. Together, they allow CSS to adapt layouts and typography automatically as the screen size changes.
Yes. Both are fully supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and mobile browsers, since around 2020, making them safe to use in WordPress themes and builders.
Wrapping Up
calc() and clamp() may seem small, but they can significantly impact how you handle responsive design. They make layouts flexible, logical, and easier to control without adding endless media queries.
- calc() handles the math. It helps you mix fixed and fluid values so your elements always fit together neatly.
- clamp() sets smart limits. It lets things scale smoothly while staying within the boundaries you define.
Used together, they create truly fluid designs that feel natural on any screen size.
WordPress already supports them everywhere, so you can start using them right away.
Next time you’re about to deal with another breakpoint, try a simple clamp() instead. You might find your design already knows how to resize itself.



