Removing Gaps in Divi Builder Layouts

Written by Dan Mossop

Designing a seamless, professional-looking website is often about managing space effectively. Gaps in Divi Builder – particularly excessive white space between sections, rows, or modules – can disrupt your layout, leading to a fragmented and less engaging user experience. This post aims to guide beginners in understanding and minimizing these gaps while offering simple solutions to enhance layout cohesion.

What Causes Gaps in Divi?

Gaps in your website layout can originate from a variety of settings within Divi Builder. Here's a breakdown of the common culprits:

Margins

Margins are like an element's personal space, dictating the distance between it and other elements. They can be set on all sides and have a significant impact on layout gaps. Large or negative margins can push elements apart unnecessarily, resulting in unsightly gaps.

Margins can be adjusted in Divi elements here:

  • {Module} Settings > Design > Spacing > Margin

Padding

Padding expands an element by adding space inside its borders, pushing its content away from neighboring elements. This can inadvertently create gaps if not carefully managed.

Padding can be configured in:

  • {Module} Settings > Design > Spacing > Padding

Heights / Min-Heights

Setting specific heights or minimum heights can also lead to gaps by forcing elements to maintain certain dimensions, pushing subsequent content further down the page. Misuse of this feature can particularly affect mobile layouts, where content resizing often requires different height parameters.

Heights can be set here:

  • {Module} Settings > Design > Sizing

Position Settings

Position adjustments can directly shift elements from their original place, potentially leaving unintended gaps. These adjustments are often made with absolute values, which lack responsiveness across different screen sizes.

Position settings are found at:

  • {Module} Settings > Advanced > Position

Other Causes of Gaps

While margins, padding, heights and position settings are some of the most common sources of gaps affecting Divi layouts, they are by no means the only ones. Other sources of gaps include the section and row heights in the customizer layout settings and mobile styles and the row gutter width in the customizer and rows themselves.

For now, we'll focus on dealing with the most common sources of gaps, but it's always worth being aware of the many ways in which gaps can occur.

Removing Gaps

Minimizing gaps effectively requires a balance of design sensibility and practical adjustments. Here’s how you can approach it:

Clear Positioning Values

Avoid using position settings to eliminate gaps. Moving elements with absolute positioning can lead to a cascading effect where multiple sections require adjustments, complicating your design with non-responsive fixes.

Clear Negative Margins

Negative margins should generally be avoided unless there's a purpose. They can be unpredictable and often complicate responsive design.

Use Heights Sparingly

Height settings should only be used when necessary for ensuring consistent element sizing, rather than for adjusting spacing. For example, if your goal is consistent spacing, use margins or paddings to achieve it instead.

Rely on Positive Margins and Padding

By using positive margins and padding, you can create a clean, manageable layout. This approach reduces the complexity of your design, making any gaps easy to identify and adjust. Margins and padding offer a flexible way to control spacing. 

Identifying the Cause of Gaps

Once we've simplified our layout, we can then use the browser's element inspection tools to track down the sources of gaps, like so.

Inspect the Gap-Forming Element

To identify the cause of a gap, right-click on the gap in your browser and select “Inspect.”

Determine Whether the Gap is Caused by Padding or Margin

The browser's developer tools will highlight the gap’s source, displaying content in blue, padding in green, and margin in orange.

With these insights, you can accurately tweak the responsible settings and minimize gaps.

Handling Different Device Widths

By following the above approach, your pages should have fewer issues on mobile and other device widths. If positive margin and padding are used for spacing and positioning, height and negative margins minimized, then the layout should naturally work reasonable well on mobile too. But, of course, there may be fine-tuning to be done, hopefully just to the margin and padding. For this, you can use Divi's built-in responsive values feature that lets you set different values on desktop, mobile and tablets. You can learn more about it here:

Setting Responsive Values for Divi Module Settings

Conclusion

By refocusing on using positive margins and padding combined with minimal height and position adjustments, you can create a more robust, responsive design. This straightforward approach simplifies the troubleshooting process and allows you to craft a cleaner, more cohesive layout. Remember, less is often more – simplify and improve your design for better results.

Streamline Your Divi Workflows

Simplify your Divi experience by effortlessly solving layout issues. The Divi Booster plugin offers numerous features that help refine spacing and adjust layouts without hassle, ensuring a seamless site appearance.

About Dan Mossop

Dan is a Scottish-born web developer, now living in Brisbane with his wife and son. He has been sharing tips and helping users with Divi since 2014. He created Divi Booster, the first Divi plugin, and continues to develop it along with 20+ other Divi plugins. Dan has a PhD in Computer Science, a background in web security and likes a lot of stuff, 

2 Comments

  1. Nice article for Divi beginners! Just wanted to add on to it by mentioning a few other places that cause gaps: the section and row heights in the customizer layout settings and mobile styles and the row gutter width in the customizer and rows itself.

    Reply
    • Thanks JP! You're exactly right. I've updated the post to include a mention of these. I'll only give them a passing mention as my real aim for this post is to have something which helps with the case I see frequently where the desktop layout has been rearranged using fixed heights, negative margins, positioning and so on, which makes the desktop view look okay, but then leads to a mess of gaps on mobile. Down the track I'll try to do a more comprehensive post on tracking down the causes of gaps which expands on the sources you've identified. Thanks again for your insights!

      Reply

Submit a Comment

Comments are manually moderated and approved at the time they are answered. A preview is shown while pending but may disappear if your are cookies cleared - don't worry though, the comment is still in the queue.

Your email address will not be published. Required fields are marked *.

We may earn a commission when you visit links on our website.

Latest From Divi Booster

How to Add the Post Status in Divi's Dynamic Content

Divi's Dynamic Content feature is great for enhancing your post/page templates with post-specific information. While Divi includes an option to show information such as the Post Created Date using Dynamic Content, there is no equivalent option for the Post Status....

Fix Divi Text Module "Regular" Font Weight Not Working

Are you encountering an issue where the font weights in Divi's Text Module don't seem to apply as expected? In particular, you might find that when you set the text module's body text font weight to "Regular", your font is actually assigned a weight of 500 instead of...

Make the Divi Gallery Module Swipeable

The Divi Gallery Module comes with a slider mode that lets you display images in a slider with clickable left/right arrows to scroll through the images. For mobile / touchscreen users, you can improve the user experience by allowing your user to swipe to navigate to...

How to Use Divi Dynamic Content in Woo Modules Product Selector

Divi's Dynamic Content is a powerful feature that lets you populate your Divi modules and theme builder templates with data pulled in various sources, such as custom fields. This allows for efficient organization and maintenance of your sites.Unfortunately, Divi's...

Random Divi Posts