Change the Spacing Between Columns in Divi Rows

|

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. 

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.