Overview of Advanced Units in Divi 5: Features Including CSS Functions and Variables

Today, we are excited to introduce Advanced Units for Divi 5, including a new multi-functional unit field that supports the full range of CSS units, functions, and variables.

It supports all CSS units, including unitless values such as unset and fit-content, and functions such as clamp() and calc(), making creating responsive designs with fluid typography easier than ever.

You can also define CSS variables and reference them throughout your designs.

Check out the following video to see the new feature in action. 👇

Divi’s New Advanced Units Field

We replaced Divi’s range slider and value picker with a new multi-functional field. You can drag it like a range slider, make minute value adjustments, or type in any value and unit.

You can also select from commonly used units and functions.

This new field does it all and includes support for all CSS units, functions, and variables.

Leverage Advanced CSS Functions

Divi’s value fields now support CSS functions! For example, functions such as calc() and clam() are very handy.

Using clamp(), you can create fluid responsive typography without responsive editing. clamp(5rem, 10vw, 15rem) scales your text smoothly as the width of the viewport changes but ensures the text will never become too small or too large.

In the video example below, text scales proportionally at 10% of the viewport width but never exceeds 15rem.

Using calc(), you can create custom formulas to calculate sizes utilizing a combination of static and relative values.

In the example video below, I have a fixed menu and want 30 pixels of space on all four sides.

If I set the width to 100%, there’s no space on either side of the menu. If I reduce the width to 90%, it’s better, but the space on either side isn’t consistent, scaling up and down with the viewport width.

I can fix this using calc! calc(100% – 60px) gives me the perfect width, with precisely 30 pixels of space on either side.

Plug In CSS Variables

Divi’s value fields now support CSS variables!

You can define CSS variables in the Theme Options or at the page level and plug those variables into Divi’s new field.

As showcased in the video below, I can define my H1-H6 title text sizes using CSS variables, then use those variables in my default Title Text preset and throughout my website. If I ever want to change the size of my headings, all I need to do is head back to the Theme Options and edit my variables.

Use Any CSS Unit

Divi’s value fields now support the full range of CSS units!

You can pair values with all available CSS units, such as VW, which scales based on the viewport width, and REM, which scales fonts relative to the root font size.

Unitless values such as fit-content scale the width of any element to fit its content, and global values such as auto, initial, and unset are useful in unsetting values inherited from larger breakpoints.

There are no limits in Divi 5!

Try Divi 5 Today

Advanced Units for Divi 5 is available today, and it’s one of many features coming to Divi this year.

You can follow along as we progress through the final release of Divi 5 and beyond, with updates every two weeks. Depending on your priorities, you can use Divi 5 now to build new websites or wait until we add more features, whatever works best for you.

As outlined in Divi 5’s original multi-phase release schedule, the Divi 5 Public Alpha is like “Divi 5 Lite.” It’s missing a few features and may not be suitable for existing websites, but it’s ready to be used on new websites if you prefer the experience to Divi 4.

We want you to try it, and if you love it, use it; when everyone loves it, we’ll make it official.

Sneak Peek: Divi Design Variables

We’re building features fast. Every time we finish a new feature, we start a new one. Whenever we start a new feature, I give you a sneak peek.

In case you missed it, check out last week’s feature sneak peek, where I showcased Divi Design Variables. It’s a bold step in a new direction for Divi and an essential part of Divi 5’s design system, which we are building to satisfy the needs of advanced web designers.

Watch this video for all the details. 👇

More Divi 5 Updates Are On The Way

2025 is the year of Divi 5. The tedious work is behind us. We built the super-fast foundation, and now it’s time for Divi to make its comeback.

If you’re here for the Divi comeback, do us a huge favor and let us know by liking this video and leaving a comment. It means a lot to us to see you cheering Divi on, and it’s essential to feed the algorithm and spread the word.

Don’t forget to follow us on YouTube and subscribe to the Divi newsletter so you never miss an update. I’ll see you soon for another Divi 5 feature announcement, which I promise will be right around the corner. 😁

The post Introducing Advanced Units For Divi 5 (Including CSS Functions & Variables) appeared first on Elegant Themes Blog.

# Overview of Advanced Units in Divi 5: Features Including CSS Functions and Variables

Divi 5, the latest iteration of the popular WordPress theme and page builder by Elegant Themes, has introduced a plethora of advanced features that enhance the design and development experience for users. Among these features, the introduction of advanced units, CSS functions, and variables stands out as a significant upgrade. This article provides an overview of these features, explaining how they can be utilized to create more dynamic and responsive web designs.

## What Are Advanced Units?

Advanced units in Divi 5 refer to the new measurement units that allow designers to specify dimensions and sizes in a more flexible and responsive manner. Traditional units like pixels (px), percentages (%), and ems are still available, but Divi 5 introduces additional units that can adapt to various screen sizes and contexts.

### Key Advanced Units

1. **Viewport Units**: These units, including `vw` (viewport width) and `vh` (viewport height), allow designers to create layouts that scale based on the size of the user’s viewport. This is particularly useful for responsive design, as it ensures that elements maintain their proportions across different devices.

2. **CSS Functions**: Divi 5 incorporates several CSS functions that enhance how units can be applied. Functions like `calc()`, `min()`, and `max()` enable more complex calculations directly within the CSS, allowing for dynamic sizing that can adapt based on other elements or conditions.

3. **Custom Units**: Users can now define custom units that can be reused throughout their designs. This feature promotes consistency and efficiency, as designers can create a standard unit that reflects their design system.

## CSS Functions in Divi 5

CSS functions are powerful tools that allow for more complex styling options. In Divi 5, the integration of CSS functions enhances the flexibility of design elements. Here are some notable functions:

### 1. `calc()`

The `calc()` function allows users to perform calculations to determine CSS property values. For example, you can set the width of a column to be half of the viewport width minus a fixed margin:

“`css
width: calc(50vw – 20px);
“`

This function is particularly useful for creating layouts that need to adjust dynamically based on the viewport size.

### 2. `min()` and `max()`

The `min()` and `max()` functions enable designers to set limits on CSS properties. For instance, you can ensure that a font size never exceeds a certain limit while still being responsive:

“`css
font-size: min(2rem, 5vw);
“`

This ensures that the font size is responsive but does not exceed 2rem, providing a balance between readability and adaptability.

### 3. `clamp()`

The `clamp()` function combines the capabilities of `min()` and `max()`, allowing designers to set a range for a property. For example, you can define a font size that scales responsively but stays within a specific range:

“`css
font-size: clamp(1rem, 2vw + 1rem, 3rem);
“`

This means the font size will grow with the viewport but will not go below 1rem or above 3rem.

## CSS Variables in Divi 5

CSS variables, also known as custom properties, are another powerful feature introduced in Divi 5. They allow designers to define reusable values throughout their stylesheets, promoting consistency and ease of maintenance.

### Benefits of CSS Variables

1. **Reusability**: Once a variable is defined, it can be used throughout the CSS, making it easy to maintain and update styles. For example:

“`css
:root {
–primary-color: #3498db;
}

.button {
background-color: var(–primary-color);
}
“`

2. **Dynamic Changes**: CSS variables can be updated dynamically using JavaScript, allowing for interactive designs that can change based on user input or actions.

3. **Theming**: CSS variables facilitate theming by allowing designers to create a set of variables for different themes and switch between them easily.

## Conclusion

The introduction of advanced units, CSS functions, and variables in Divi 5 marks a significant step forward in web design capabilities. These features empower designers to create more responsive, dynamic, and maintainable websites. By leveraging viewport units, CSS functions like `calc()`, `min()`, `max()`, and `clamp()`, along with the power of CSS variables, users can enhance their design workflows and deliver exceptional user experiences. As web design continues to evolve, Divi 5 stands out as a robust tool that meets the demands of modern web development.