clamp() values so that sizes and spacing shift continuously and proportionally as the viewport width changes — no breakpoint overrides required.
Why fluid scaling helps
With a traditional breakpoint approach, you define a value at several fixed widths and accept that it stays constant between those points. The result is a series of visual steps:- A heading is 24 px from 0–767 px, then jumps to 32 px at 768 px, then to 48 px at 1200 px.
- The jump is immediate and can look mechanical, especially on mid-range or foldable devices that sit between your defined breakpoints.
- Better readability at every viewport width, not just the ones you explicitly designed for.
- Fewer utility classes per element — one class covers the full range rather than needing a base class plus several
--on-*overrides. - More natural proportions between typographic scale and layout at intermediate sizes like tablets, landscape phones, and ultrawide monitors.
How it works
Fluid scaling relies on the CSSclamp() function, which accepts three arguments: a minimum value, a preferred (viewport-relative) value, and a maximum value.
rem base with a vw component so it grows as the viewport widens.
Here is an example from a large heading utility:
- At narrow viewports,
font-sizeclamps to 2 rem (the minimum). - As the viewport widens,
font-sizefollowscalc(1.5rem + 2vw), growing proportionally. - At wide viewports,
font-sizeclamps to 4 rem (the maximum) and stops growing.
clamp() expressions for each step in a fluid utility family, so you apply a class like text-xl or m-8 and the browser handles the interpolation automatically.
The
clamp() function has broad browser support across all modern browsers. No polyfill or fallback is needed for Elementor sites targeting current browser versions.Fluid vs. fixed utility families
Not every utility benefit from fluid scaling. Layout helpers, color utilities, and declarative states have values that are categorical rather than continuous — there is no meaningful “interpolation” betweendisplay: flex and display: block. AtomicKit applies fluid scaling only where smooth transitions add value.
| Family | Scaling | Reason |
|---|---|---|
text-* (font sizes) | Fluid | Typography reads better when it scales proportionally with the viewport |
m-* (margin) | Fluid | Spacing that breathes at large viewports and compresses gracefully on mobile |
p-* (padding) | Fluid | Same rationale as margin — proportional containment feels natural |
gap-* (flex/grid gap) | Fluid | Grid and flex gaps should stay proportional to the items they separate |
| Colors | Fixed | Colors are categorical — there is no “halfway” between two brand colors |
| Font weights | Fixed | Weight steps are discrete; intermediate values look inconsistent across fonts |
display / positioning | Fixed | These are on/off states, not continuous scales |
maximum-width-* | Fixed | Container max-widths are layout constraints tied to specific design decisions |
| Border widths | Fixed | Hairline, thin, and medium borders are intentional categorical choices |
| Component presets | Fixed | Preset styles encode specific design intent and should not drift |
leading-* (line-height) | Fixed | Line-height ratios are unitless multipliers, not viewport-relative values |
Best practices
Let fluid classes do the work before adding breakpoint overrides
Let fluid classes do the work before adding breakpoint overrides
Because
text-*, m-*, p-*, and gap-* classes already scale across the full viewport range, you usually don’t need to add --on-* suffix variants for those families. Reach for a responsive suffix only when you also need a structural change (like switching flex direction), not just to adjust a size.Pair fluid spacing with fluid typography
Pair fluid spacing with fluid typography
Fluid scaling works best when the sizing relationships stay consistent. If your headings scale fluidly but your padding is fixed, the proportion between text and its container will shift noticeably at extreme screen sizes. Apply fluid
p-* or m-* classes to the same containers where you use fluid text-* classes.Use the minimum and maximum as your design constraints
Use the minimum and maximum as your design constraints
Think of fluid scaling as designing two states — the smallest acceptable size and the largest acceptable size — and letting the browser interpolate between them. Define your design intent at mobile and desktop sizes first, then verify the intermediate sizes look proportional rather than designing for every breakpoint individually.
Don't mix fluid utilities with fixed custom CSS on the same property
Don't mix fluid utilities with fixed custom CSS on the same property
If you apply a fluid
text-lg class and also write a custom CSS rule that sets font-size: 18px on the same element, the specificity battle will produce unpredictable results depending on selector weight. Keep fluid properties under AtomicKit classes and reserve custom CSS for properties AtomicKit doesn’t cover.Related references
Typography Utilities
Browse the full
text-* scale and see the clamp() values output by each step, from text-xs to text-9xl.Spacing Utilities
Explore the fluid
m-*, p-*, and gap-* scales — including the clamp() ranges applied at each spacing step.