Change the Spacing Between Columns in Divi Rows

Written by Dan Mossop

The Divi Theme allows you to lay modules out side-by-side in multi-column rows. However, it is not particularly obvious how to adjust the spacing between the modules in adjacent columns. Fortunately, Divi's 'gutter width' options within the row settings offer a degree of control over this space. However, the built-in settings are limited. This document provides a step-by-step guide on how to enable custom gutter widths using the Divi Theme's settings and custom CSS.

To change the spacing between modules in adjacent Divi row columns:

  1. Go to Row Settings > Design > Sizing.
  2. Enable 'Use Custom Gutter Width' to reveal the 'Gutter Width' option
  3. Choose a value (1-4) for the 'Gutter Width'

For more control, you can use CSS to set a custom gutter width

Here's an example of a three-column row with default spacing between the columns / modules: 

Adjusting Module Spacing in Divi Rows Using Gutter Options

When configuring a Divi row containing multiple columns, the space between modules can be adjusted using gutter options within the row settings. Here's how to customize the gutter width beyond the standard settings provided by Divi.

  1. Navigate to Row Settings > Design > Sizing.
  2. Activate the 'Use Custom Gutter Width' option to reveal the 'Gutter Width' setting.

The Gutter Width setting provides four discrete margin (i.e. "gutter") values for columns within a row:

  • Value 1: No margin
  • Value 2: Margin of 3%
  • Value 3: Margin of 5.5% (default setting)
  • Value 4: Margin of 8%

Note that this margin is applied to the right side of all columns except the last one.

Here's and image depicting module settings when a custom gutter value of 2 is selected: 

And here's an image showing the row appearance after applying a custom gutter width: 

Implementing Custom Gutter Widths with CSS

To achieve more granularity in gutter width beyond the preset values, the following CSS can be applied:

@media only screen and (min-width: 981px) {

	.row-with-custom-gutters .et_pb_column {
		--num-cols: 3;
		--gutter-width: 4%;
	}
	
	.row-with-custom-gutters .et_pb_column:not(.et-last-child)  {
		margin-right: var(--gutter-width) !important;
	}
	
	.row-with-custom-gutters .et_pb_column  {
		width: calc((100% - (var(--gutter-width) * (var(--num-cols) - 1))) / var(--num-cols)) !important;
	}
}

To utilize the above CSS, the class row-with-custom-gutters needs to be added to the row's CSS class field, which is located in Row Settings > Advanced > CSS ID & Classes.

The –num-cols value should be set to the same as the number of columns in the row, and the –gutter-width should be set to the desired right margin on the modules (which dictates the gutter spacing. 

Applying this CSS provides complete control over spacing, allowing for precise adjustment of margins between columns and modules within a row. 

Optimize Spacing with Divi Booster

Fine-tune the spacing between columns and unlock hundreds of new features with Divi Booster! Experience enhanced design control in Divi with ease.

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, 

0 Comments

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 Posts

Set Custom CSS IDs for Individual Divi Accordion Items

Assigning unique CSS IDs to specific Divi Accordion items allows for precise control over styling, targeting, and linking within your page content. This ability is particularly useful when you want to apply custom designs or create anchor links to particular accordion...

Enable Swipe Navigation in the Divi Gallery Lightbox

Enabling swipe navigation in the Divi Gallery module's lightbox allows users to seamlessly browse through gallery images by swiping left or right, creating a more interactive and mobile-friendly experience. This functionality can significantly improve user engagement...

Disable Slide-In Animation for Divi Gallery Grid Images

Control how images appear in your Divi Gallery module by toggling the slide-in animation effect for grid layouts. Disabling the slide-in animation allows gallery images to load instantly and appear statically, providing a faster and distraction-free browsing...

Control Image Count Display in Divi Gallery Lightbox

Displaying or hiding the image count in the Divi Gallery module’s lightbox can help customize the user experience, depending on whether you want to give visitors an indication of gallery progress or prefer a cleaner, distraction-free view. The ability to toggle this...

Hide Gallery Image Titles in the Divi Lightbox Overlay

Displaying image titles in the lightbox overlay of the Divi Gallery module can sometimes be distracting or unnecessary, depending on your website’s design and user experience goals. Hiding these titles creates a cleaner and more focused viewing experience for visitors...

Random Posts