custom breakpoints to divi theme

How to add custom breakpoints to Divi theme

by | Aug 24, 2023 | 0 comments

Responsive web design is crucial to ensure your website looks great on various devices and screen sizes. The Divi theme, a popular choice among WordPress users, offers a range of tools to achieve this. One powerful technique is adding custom breakpoints, allowing you to control how your site adapts to different screen dimensions. In this guide, we’ll walk you through the process step by step, empowering you to tailor your Divi modules with ease.

1. Adding a Unique Class to the Divi Module:

Start by opening the Divi page builder and selecting the module you intend to modify. Whether it’s a section, row, or specific element, pinpoint the module that needs a custom breakpoint.

Access the module settings and navigate to the Advanced tab. Here, you’ll find a field labeled “CSS Class.” Assign a unique class name that will be the identifier for this specific customization. For example, you could use something like “custom-breakpoints” as your class name.

2. Adding a Code Module:

To integrate your custom breakpoint, introduce a new Code module into the page layout. In the page builder, locate the plus icon and add a Code module to the desired location.

In the settings of the Code module, select “CSS” as the code type. This will enable you to inject your custom CSS code directly into the module.

3. Modifying the CSS Code for Custom Breakpoints:

Now comes the heart of the customization process. Inside the CSS code editor of the Code module, incorporate your custom breakpoint using media queries. Media queries are CSS rules that apply specific styles based on certain conditions, such as screen size.

For instance, if you wish to add a breakpoint at 1366px, the following code illustrates how to achieve this:

css

@media only screen and (min-width: 1366px) and (max-width: 1920px) {

/* Add your custom CSS code here */

}

Within the curly braces, replace the comment with the actual CSS code you want to apply to the module when the screen width falls within the specified range.

4. Preview and Save:

Once you’ve added and customized the CSS code, save your changes and preview the page. You’ll be able to witness the impact of your custom breakpoint as you resize your browser window or test on different devices.

By following these straightforward steps, you’ve gained the ability to implement custom breakpoints within the Divi theme. This technique empowers you to finely adjust the appearance and layout of your website across various screen sizes, ensuring an optimal user experience for every visitor.

Learn more on this topic

Related Blog Posts

Can I Use Divi and Elementor Together

Can I Use Divi and Elementor Together

In the world of making websites, two tools called Divi and Elementor are really popular. Divi helps you build websites by dragging and dropping things around, while Elementor is similar but with some different features. Understanding Divi and Elementor Divi: It's a...

Add a 3-Color Gradient to Divi Sections

Add a 3-Color Gradient to Divi Sections

Certainly! Below is a step-by-step tutorial on how to add three-color gradients to Divi modules and sections using Divi settings, as well as how to achieve the same effect using custom CSS with the help of https://cssgradient.io/. Adding 3-Color Gradients to Divi...