Adding Custom Breakpoints to Divi

It is no secret that the talented devs over at Elegant Themes have put a lot of thought and effort into making Divi the premier tool for creating responsive websites that look fantastic across all devices. You can easily with a few clicks of mouse apply settings and styles to specific screen sizes, you can even enable or disable entire sections, rows, or modules. This is all super handy, but sometimes it happens that you bump into situations where Adding Custom Breakpoints to Divi Modules will help you cater to additional devices or target some niche scenarios.

Unfortunately, Divi does not natively allow you to target a wider or more specific set of screen sizes, so it is up to you to get your hands dirty and add some custom code to be able to make the changes you want. Now we realize that many of the folks out there use Divi to avoid having to write code but don’t stress, we are going to show you how to easily add your CSS to specific screen sizes by Adding Custom Breakpoints to your Divi Modules.

Video Tutorial

What are Divi Breakpoints?

Divi or CSS Breakpoints allow you to define some rules that control how your site, or elements on your site, are displayed on different screen sizes. With smartphones and tablets being in the hands of more people than ever, the need to be able to target all these different screen sizes is larger than ever.

Divi is great, but it is not realistic to have Divi cater to all these screen sizes out of the box. That said, Divi has crafted 3 breakpoints that would target some of the most popular screen sizes.

Divi Desktop Breakpoints

Desktops & Laptops

981 Pixels & Above

Divi Tablet Breakpoints

Tablets

768 to 980 Pixels

Divi Phone Breakpoints

Mobile Phones

767 Pixels & Below

Changing Settings based on the Divi Breakpoints

Now that we know what the Divi Breakpoints are, we can use the native Divi Builder Tools to make our site look different based on what device our visitors are using to browse it.

To do this, all we need to do is hover any setting of a module, row, or section, and then click on the icon for the device we want to manipulate the settings for.

Divi Module Responsive Settings
This works really great because you can manipulate the actual content, size, or other styling settings based on the size of the screen.

Adding Custom Breakpoints to Divi Modules

So as we discussed, these built-in Divi features are super easy to use, but there might be times you need a little more flexibility which means that we will need to add a little bit of custom code to make things happen.

What we need to do is tell Divi that when a screen of a certain size is browsing the page, that a certain set of values should be applied to the target module. Let’s do a quick example that will display some text based on the size of the screen the page is being shown on.

Step 1) Add a Unique Class to the Divi Module

Browse to the page where you would like to add the custom breakpoint and hit Edit.

Now add a Text Module and type “This is a ” into the content area.

With that setup, click on the Advanced Tab of the Text Module and add a unique class, we will use de-breakpoint.

Save the Module.

Step 2) Add a Code Module

Click the grey “+” and add a Code Module anywhere on the page.

Add an opening and closing <style> </style> tags.

Copy and paste the code below between the <style> </style> tags.

Step 3) Modify the CSS Code

For each instance of “YOUR CSS HERE”, delete it and we will use that .de-breakpoint class we created earlier to manipulate the text module.

Copy and paste the code below in the place where you just deleted the text.

Now for each breakpoint, replace the text in the Content property with the type of device you are targeting for example “Extra Large Desktop” or “Medium Tablet“.

Save the Module.

Update the Page.

Step 4) Test it Out!

Using your favorite desktop browser, open the saved page.

Now when you resize the window, you will see that it updates the text with the active Custom Divi Breakpoint for that module.

Divi Custom Breakpoints Preview

Quick Review

This was a pretty basic example to demonstrate the different Custom Breakpoints we added to our Divi Text Module, but there is a ton of other things you can do. For example, you can add more or fewer breakpoints, that have breaks at different pixel sizes, all you need to do is modify those values in the code we supplied.

You can also drop the class we used and target certain elements in Divi site-wide by using the appropriate class by adding your breakpoint CSS to Divi > Theme Options > Custom CSS.

For example, maybe you have a Full-width Menu Module on a page that you want to behave differently outside of the default Divi breakpoints. All you would need to do is target the module with the .et_pb_fullwidth_menu and .fullwidth-menu-nav CSS classes underneath your target breakpoint.

Hooray for Breakpoints and Responsive Design using Divi!
Responsive Flip Phone

Conclusion

Adding Custom Breakpoint to Divi Modules was the only kind of scary, right? There are so many different ways you can utilize this skill to further fine-tune your site to meet your goals, we don’t always have to wait for the Elegant Theme Team to add a feature like this.

Definitely show us in the comment section what you guys achieve using this new skill, maybe you’ll even teach us a thing or two 😉

3 Comments

  1. Hi, thank you for a really nice post. My question is, how to change breakpoints for custom menu built in theme builder. I need to set hamburger menu earlier from 1024 px. I have tried several ccs codes but without any success.
    For example:

    /* Switch to hamburger menu at 1024px width or less */
    @media (max-width: 1024px) {
    .custom-hamburger-menu .et_pb_menu__wrap {
    display: none;
    }
    .custom-hamburger-menu .et_mobile_nav_menu {
    display: block !important;
    }
    .custom-hamburger-menu .mobile_nav {
    display: block !important;
    }
    .custom-hamburger-menu .mobile_menu_bar {
    display: block !important;
    }
    }

    /* Hide the hamburger menu and display the classic menu at widths greater than 1024px */
    @media (min-width: 1025px) {
    .custom-hamburger-menu .et_pb_menu__wrap {
    display: block !important;
    }
    .custom-hamburger-menu .et_mobile_nav_menu {
    display: none !important;
    }
    .custom-hamburger-menu .mobile_nav {
    display: none !important;
    }
    .custom-hamburger-menu .mobile_menu_bar {
    display: none !important;
    }
    }

    Do you have any idea how to do it?

    Many thanks

    Kristyna

  2. I noticed your media queries lack anything in the 980px – 1100px space.

  3. Nice post. However, I tried this with a 4-column ROW module with four images in each column. With the CSS I specified the below in order to have the 4-column ROW module turn into a 2-column row module at the desired breakpoint. It worked, BUT Divi retained the frou images in each column and created a 2-column row featuring 4 images in each row… not quite the desired effect.

    .md-breakpoint {
    columns: 300px 2;
    }

    I’m am simply trying to get 4-column rows to break into 2-column rows earlier in DIVI.

    Any insights would be amazing! Huge fan of the Divi Engine Mega Menu and Mobile Menu module by the way 🙂

Submit a Comment

Explore more from Divi Engine