Skip to main content

Understanding Flex Justify Content in Divi 5

Learn how to control the Flexbox items' horizontal alignment in Divi 5’s new Flexbox Layout using the Justify Content option.

Updated over 2 months ago

Divi 5 relies on native CSS flexbox. The Justify Content option allows you to control how the flexbox items are aligned on the horizontal axis, especially when each flexbox item has a fixed width.

Important Notes:

  1. The Justify Content option is related to the Layout Direction option as follows:

    • If the Layout Direction option is set to Row or Row Reverse, the Justify Content option will align the flex items on the horizontal axis.

    • If the Layout Direction option is set to Column or Column Reverse, the Justify Content option will align the flex items on the vertical axis.

  2. Each flex item should have a fixed width if the Layout Direction is set to Row or Row Reverse.

  3. The flex container should have a height set if the Layout Direction is set to Column or Column Reverse.

In the following examples, the Flex container is the Column, the Layout Direction is Column, and the Column contains three Text modules:

  • Text module 1 has a fixed width of 120px.

  • Text module 2 has a fixed width of 220px.

  • Text module 3 has a fixed width of 330px.

Justify Content → Start

The Text modules are aligned to the left/top edge.

Layout Direction → Row

Layout Direction → Column

Divi 5 - Justify Content Start in a Row Directional Layout

Divi 5 - Justify Content Start in a Column Directional Layout

Justify Content → Center

The Text modules are aligned in the center on the X and Y axes.

Layout Direction → Row

Layout Direction → Column

Divi 5 - Justify Content Center in a Row Directional Layout
Divi 5 - Justify Content Center in a Column Directional Layout

Justify Content → End

The Text modules are aligned at the right/bottom edge.

Layout Direction → Row

Layout Direction → Column

Divi 5 - Justify Content End in a Row Directional Layout

Divi 5 - Justify Content End in a Column Directional Layout

Justify Content → Space Between

The Text modules are evenly distributed on the X/Y axis.

Layout Direction → Row

Layout Direction → Column

Divi 5 - Justify Content Space Between in a Row Directional Layout

Divi 5 - Justify Content Space Between in a Column Directional Layout

Justify Content → Space Around

The Text modules are evenly distributed on the X/Y axes with equal space around each Text module.

Layout Direction → Row

Layout Direction → Column

Divi 5 - Justify Content Space Around in a Row Directional Layout

Divi 5 - Justify Content Space Around in a Column Directional Layout

Justify Content → Space Evenly

The Text modules are evenly distributed with equal space around them.

Layout Direction → Row

Layout Direction → Column

Divi 5 - Justify Content Space Evenly in a Row Directional Layout

Divi 5 - Justify Content Space Evenly in a Column Directional Layout

Use Case: Centering two Button modules (side by side) in a custom Call-To-Action Section

Divi 5 - Example of Justify Content Usage

Let's say you're building a full-width CTA with two buttons. You want them centered and evenly spaced:

  1. Add a row with text-based modules such as the Heading module (for the Call to Action's title) and the Text module for the Call to Action's body text.

  2. Add the Group module. This will be used as the container for the two Button modules.

  3. Add the two Button modules inside the Group module.

  4. Edit the Group Module settings.

  5. Go to the Design Tab → Layout → Justify Content and choose Center

  6. Optionally, change the Horizontal Gap value to increase or decrease the space between the two Button modules.

Optional changes:

  1. Edit the Column that contains all modules and set a background color, gradient, mask, etc

  2. Set some Padding on the column to create some breathing room between the column's top/bottom/left/right edges and the modules.

Did this answer your question?