Understand min() and max() Bounds in Divi 5

By Dave TanguayPublished Updated Editorial draft

Quick Answer

min() chooses the smallest evaluated argument; max() chooses the largest. This can make min useful for a cap and max useful for a floor. A floor can exceed the available space, and neither function decides how content should wrap or columns should rearrange.

Read the result before the function name

The publisher tutorial, last updated May 19, 2025, demonstrated these functions in Divi. MDN’s min reference and max reference define the smaller and larger result precisely.

For an illustrative width of min(100%, 48rem), assume a 16 CSS-pixel root size, so 48rem is 768 pixels. With an available containing width of 320 pixels, the smaller argument is 320. With 1,024 pixels available, it is 768. Review padding, box sizing and other constraints separately.

A floor does not provide an upper limit

Consider the illustrative padding value max(1rem, 2vw) under the same root-size assumption.

Viewport width Larger argument selected
320 CSS pixels 16 pixels rather than 6.4 pixels
800 CSS pixels Both arguments equal 16 pixels
1,440 CSS pixels 28.8 pixels rather than 16 pixels

The value can continue growing beyond 28.8 pixels as the viewport grows. The fixed argument sets a floor in this example, not an upper cap.

Check whether the floor can fit

A width of max(80%, 20rem) cannot become smaller than 20rem through that expression alone. At a 16-pixel root size, that is 320 pixels. If only 280 pixels are available, the selected width can overflow unless other applicable constraints change the result.

Similarly, height: min(50rem, 90vh) chooses the smaller height; it does not promise a minimum height for the content. Prefer a content-appropriate sizing approach and test long text instead of copying a full-height hero example.

Verify the actual property and control

Use the documented Divi unit picker in a supported field. Confirm the function mode, arguments and saved output. A bound on max-width has a different responsibility from the same expression placed directly on width.

Our bounded content-wrap guide and fluid spacing-ramp guide cover specific clamp applications. Our calc expression guide covers arithmetic and input checks. For an existing overflow problem, our development team can review the affected property and parent constraints.

Key Takeaways

  • Min chooses the smaller result; max chooses the larger.
  • A fixed floor can exceed available space.
  • Interpret the expression in the property and layout receiving it.

Frequently Asked Questions

Is max() the same as max-width?

No. Max is a function that selects an argument. Max-width is a property limiting width; the receiving property determines what the result controls.

Does a max() floor guarantee a usable phone layout?

No. The floor may exceed a narrow parent. Test the actual available space and content.

When do I need clamp()?

Consider it when one value needs a minimum, a preferred expression and a maximum. It still does not replace layout or content-fit decisions.

Archives