Part 11: Mastering CSS Grid In Divi 5

by | May 22, 2026 | Etcetera | 0 comments

Earlier than Divi 5, development layouts that broke out of Divi’s usual column constructions frequently intended nesting rows, writing customized CSS, or settling for a more effective design. Divi 5 adjustments that via bringing CSS Grid into the Visible Builder.

CSS Grid provides you with actual regulate over two-dimensional layouts. As an alternative of best arranging pieces in a row or column, you’ll outline rows and columns on the similar time. Then, you’ll position youngster parts throughout that construction.

In Divi 5, layout-capable packing containers reminiscent of Sections, Rows, Columns, Teams, and supported nested Module packing containers can use Grid. As soon as a container is about to Grid, you’ll regulate key grid settings reminiscent of monitor counts, gaps, alignment, merchandise placement, and rule-based offsets from the settings panel.

That is Phase 11 of the Divi 5 Mastery Route. On this section, we’ll take one Row containing six Columns with content material and styling already implemented. Then, we’ll reshape it 3 other ways the usage of row-level grid controls.

First, we’ll use a one-click Construction Template. Subsequent, we’ll use a special Construction Template with Grid Offset Laws. In the end, we’ll use a Masonry template that mixes a denser column construction with multi-property offset regulations. After that, we’ll upload responsive overrides at pill and speak to breakpoints.

The content material and column-level types keep the similar. Most effective the Row-level Format choice staff and Grid Offset Laws do the paintings.

By means of the tip, you’ll know the way to navigate Divi 5’s Grid settings, use Construction Templates, perceive Grid Offset Laws, and adapt complicated grids throughout breakpoints. In conjunction with the Flexbox ideas from Phase 10, CSS Grid provides you with a more potent structure toolkit for development customized Divi 5 internet sites.

How CSS Grid Works

CSS Grid is a structure means constructed into fashionable browsers. Whilst Flexbox arranges pieces basically alongside one axis, both a row or a column, Grid arranges pieces in two dimensions immediately.

You outline the construction within the dad or mum container. Then, its youngsters fill that construction as grid pieces.

Mother or father And Kid Controls

Two layers of regulate subject.

  1. The dad or mum, or grid container, defines the construction. This comprises what number of columns and rows there are, how large and tall each and every monitor is, the distance between tracks, and the default alignment of things within the grid.
  2. Each and every youngster, or grid merchandise, can override its personal placement. A unmarried merchandise can span more than one cells, get started at a particular column or row, or align another way from its siblings.

Divi 5 follows this similar parent-and-child type. The Format choice staff at the dad or mum controls the grid construction. The Sizing choice staff on each and every youngster controls how that kid sits within the grid.

As soon as that psychological type is obvious, the settings turn into more uncomplicated to are expecting. Mother or father settings outline the grid. Kid settings outline how particular person pieces behave within it.

Visual comparison of Flexbox and CSS Grid in Divi 5

How To Set A Container To Grid

You’re going to most often use Grid on packing containers reminiscent of Sections, Rows, Columns, and Teams. With Divi 5’s Nested Modules gadget, supported local modules too can act as structure oldsters and include different modules or rows.

Grid structure settings are implemented on the dad or mum container point. They outline the overall regulations for the way the grid works and the way youngster pieces reply to it.

Get started With A Easy Grid

Let’s get started via development one thing easy. Upload a Segment with a single-column Flex Row. Then, open the Row settings and alter the Row from Flex to Grid.

Subsequent, trade the Row’s grid construction to a 6-column grid.

When running with Grid, it is helping to split two concepts. A grid column is a part of the CSS Grid construction. A Divi Column is a Divi container component.

See also  Download a FREE Blog Post Template for Divi’s Web Developer Layout Pack

Including grid columns within the Format settings isn’t the similar as including Divi Columns to a Row. Alternatively, the 2 can paintings in combination.

Now, upload six Divi Columns within the Row. You presently have six Divi Columns positioned into six grid columns.

Subsequent, trade the grid construction from six columns to 3 columns. Realize how the similar six Divi Columns waft into the brand new construction.

Should you take a look at the breakpoints, the 3-column grid stays in position until you override it at a particular breakpoint.

This straightforward instance presentations the core Grid workflow. Outline the grid construction on the dad or mum point. Then, let the kid parts waft into it.

Earlier than transferring additional, let’s take a look at the principle Grid settings Divi supplies.

Row-Degree Grid Settings: The Format Choice Crew

When a Row is about to Grid, the Format choice staff controls the grid construction. Here’s a fast reference for the principle settings.

  • Horizontal Hole and Vertical Hole: Keep watch over spacing between grid columns and rows.
  • Column Widths: Keep watch over how grid columns are sized, together with equivalent widths or customized monitor sizing.
  • Selection of Columns: Defines what number of columns the grid makes use of.
  • Cave in Empty Columns: Is helping with dynamic layouts the place some grid cells could also be empty.
  • Grid Auto Columns: Units the scale of robotically generated columns when pieces are positioned outdoor the outlined grid.
  • Row Heights: Controls how grid rows are sized, together with auto-height rows or equal-height rows.
  • Selection of Rows and Grid Auto Rows: Supply row-based controls very similar to the column controls above.
  • Grid Course: Controls how pieces auto-place during the grid, reminiscent of row route or column route.
  • Grid Density: Controls whether or not the grid follows standard supply order or backfills empty cells with later pieces when imaginable.
  • Justify Content material and Align Content material: Place the entire grid within the container when more room is to be had.
  • Align Pieces and Justify Pieces: Set the default alignment for pieces within their grid cells.
  • Offset Laws: Observe position-based structure regulations to youngster pieces from the dad or mum point. Those are helpful for uneven or repeating grid patterns.

Kid-Degree Grid Settings: The Sizing Choice Crew

Mother or father-level Grid settings outline the grid. Kid parts can nonetheless regulate how they occupy area within that grid.

Click on into one of the most six Columns. Open the Design tab and increase the Sizing choice staff.

Beneath the usual Width, Top, and Module Alignment controls, grid merchandise settings seem.

  • Column Span and Row Span: Keep watch over what number of grid tracks the article occupies. For instance, environment Column Span to two makes the article span two grid columns.
  • Column Get started, Column Finish, Row Get started, and Row Finish: Pin the article to precise grid traces. Use those when a span price isn’t actual sufficient, reminiscent of when an merchandise wishes to begin at column 2 and finish at column 5.
  • Align Self and Justify Self: Override the dad or mum’s default alignment for that merchandise best.

Those controls seem on direct youngsters of a dad or mum container set to Grid, together with Columns, Teams, and modules. They’re helpful for asymmetrical layouts the place one card occupies a bigger hero block whilst the remainder playing cards sit down in a tighter association.

On this instructional, we’ll most commonly use Grid Offset Laws on the dad or mum point as a substitute of enhancing each and every youngster manually. That way shall we us create repeating structure patterns that proceed to paintings despite the fact that extra youngster pieces are added later.

Alternatively, when you’ve got a set collection of youngster parts, environment customized spans at the particular person youngsters too can paintings smartly.

Exploring What’s Imaginable With CSS Grid In Divi 5

CSS Grid is a logical strategy to regulate how youngster parts behave within a container. As you noticed above, the dad or mum can outline the entire grid whilst particular person youngsters can nonetheless destroy from the default trend.

To concentrate on Grid, we’ll stay the usage of the six-Divi-Column construction from the former segment. The content material and common types are already in position. Subsequently, the examples beneath focal point best on converting the grid structure.

3 Format Diversifications

We’ll reshape the similar content material 3 ways:

  • Variation 1: A easy grid created with one Construction Template.
  • Variation 2: An alternating grid created with a Construction Template and Grid Offset Laws.
  • Variation 3: A masonry-style grid created with multi-property offset regulations and responsive overrides.

Variation 1: Observe A Construction Template

We have now already noticed learn how to trade a Row to Grid and alter the collection of grid columns. The quickest strategy to get a running grid structure is to let Divi configure the ones settings with a Construction Template.

See also  How To Create A Custom Blog Post Loop With Divi 5’s Loop Builder

Transfer to the Row’s Content material tab. On the backside of the Components checklist, click on Observe Construction Template.

Apply Structure Template button in Divi 5

Select a Multi-Row Template

You’re going to see grouped templates, together with preconfigured grid layouts. Glance below Multi-Row, Masonry, and Sidebar. Each and every thumbnail represents a whole structure configuration, together with the collection of columns, hole values, and merchandise placement regulations.

Pick out the 3rd Multi-Row template. The Row updates to a 3-column grid with defaulted 60px Horizontal Hole and 60px Vertical Hole values.

Open the Row’s Design tab and take a look at the Format choice staff. You must see Format Taste set to Grid, Selection of Columns set to 3, and the distance values implemented.

This straightforward grid construction works smartly for provider options, product loops, weblog layouts, and different flippantly spaced card layouts.

Variation 2: Use Grid Offset Laws

For the second one variation, we’ll use a special Construction Template that creates an alternating trend with Grid Offset Laws. Those regulations regulate which youngster pieces span further columns.

Within the Row’s Content material tab, click on Observe Construction Template once more. Then, select the 11th Multi-Row template. The Row nonetheless makes use of 3 grid columns, nevertheless it provides offset regulations that ensure youngster pieces span more than one column tracks.

Investigate cross-check The Offset Laws

Divi’s Construction Templates can come with greater than elementary column counts. Some templates additionally come with offset regulations, because of this you’ll follow a Grid structure and its repeating placement good judgment in a couple of clicks.

Now, let’s check out the foundations. Open the Row’s Design tab, increase the Format choice staff, and in finding Grid Offset Laws. You must see two regulations created via the Construction Template.

Grid Offset Rules in the Divi 5 Layout option group

Rule 1: Span Each and every 4n+2 Merchandise

The primary rule makes use of those settings:

  • Admin Label: Auto-generated from the rule of thumb settings, reminiscent of 4n+2 Spans 2 Columns.
  • Goal Offset: Customized nth-child Rule, with the trend set to 4n+2. This suits the second merchandise, then each 4th merchandise after that: 2, 6, 10, and so forth.
  • Offset Rule: Column Span. This tells Divi which grid estate to switch at the focused pieces.
  • Offset Worth: 2. This makes each and every focused merchandise span two column tracks as a substitute of 1.

Learn from most sensible to backside, the rule of thumb says: goal pieces 2, 6, 10, and onward, and make each and every one span two column tracks.

That creates a repeating trend the place each fourth focused merchandise turns into wider at the proper facet of the grid.

Rule 2: Span Each and every 4n+3 Merchandise

The second one rule does the similar factor, however goals a special set of kid pieces.

  • Admin Label: Auto-generated from the rule of thumb settings, reminiscent of 4n+3 Spans 2 Columns.
  • Goal Offset: Customized nth-child Rule, with the trend set to 4n+3. This suits the third merchandise, then each 4th merchandise after that: 3, 7, 11, and so forth.
  • Offset Rule: Column Span. This adjustments the similar grid estate as the primary rule, however for a special merchandise trend.
  • Offset Worth: 2. This makes each and every focused merchandise span two column tracks.

In combination, the 2 regulations create an alternating rhythm. The second merchandise in each and every staff of 4 spans two columns. In the meantime, the third merchandise in each and every staff of 4 additionally spans two columns. The first and 4th pieces stay one column large.

Invert The Development

Should you sought after to invert the trend and get started with a bigger merchandise, it’s essential to trade the foundations to those patterns:

  • First Rule: 4n+1 spans two columns.
  • 2nd Rule: 4n+4 spans two columns.

Inverted Grid Offset Rule pattern in Divi 5

Grid Offset Laws open up many structure probabilities as a result of they can help you create repeating uneven patterns from the dad or mum container. Subsequent, we’ll use a extra complicated grid construction.

Variation 3: Create A Masonry-Taste Grid

The 3rd variation makes use of a Masonry Construction Template and two Grid Offset Laws. This time, the foundations goal two other grid houses in the similar structure: Row Span and Column Span.

Within the Row’s Content material tab, click on Observe Construction Template and select the second one template below Masonry.

Investigate cross-check The Masonry Settings

The template applies a number of Format settings. Open the Row’s Design tab to check out them.

  • Selection of Columns: 4
  • Offset Laws: Two regulations, one for spanning throughout rows and one for spanning throughout columns.

The Offset Laws do many of the paintings on this structure.

Rule 1: Span Each and every 6n+1 Merchandise Throughout Rows

The primary rule makes use of those settings:

  • Admin Label: Auto-generated from the rule of thumb settings, reminiscent of 6n+1 Pieces Span 2 Rows.
  • Goal Offset: Customized nth-child Rule, with the trend set to 6n+1. This suits the first merchandise, then each sixth merchandise after that: 1, 7, 13, and so forth.
  • Offset Rule: Row Span. This adjustments what number of row tracks the focused merchandise occupies.
  • Offset Worth: 2. This makes each and every focused merchandise soak up two row tracks as a substitute of 1.
See also  How one can Attach Microsoft Outlook to WordPress (Step by way of Step)

Learn most sensible to backside, the rule of thumb says: goal pieces 1, 7, 13, and onward, and make each and every one two times as tall. This creates the tall anchor merchandise originally of each and every staff of six.

Rule 2: Span Each and every 6n+6 Merchandise Throughout Columns

The second one rule works at the different axis.

  • Admin Label: Auto-generated from the rule of thumb settings, reminiscent of 6n+6 Pieces Span 2 Columns.
  • Goal Offset: Customized nth-child Rule, with the trend set to 6n+6. This suits the sixth merchandise, then each sixth merchandise after that: 6, 12, 18, and so forth.
  • Offset Rule: Column Span. This adjustments what number of column tracks the focused merchandise occupies.
  • Offset Worth: 2. This makes each and every focused merchandise span two column tracks as a substitute of 1.

The 2 regulations paintings in several dimensions. The primary stretches the primary merchandise in each and every staff of six vertically. The second one stretches the general merchandise in each and every staff of six horizontally.

Should you reproduction the Divi Columns till you’ve got 12 overall pieces, you’ll see how the foundations repeat each six youngster pieces.

Make The Masonry Format Responsive

The masonry trend works smartly on desktop, however a 4-column grid with higher anchor pieces can really feel cramped on smaller monitors. That is the place responsive Grid settings turn into necessary.

Grid settings in Divi 5 can also be adjusted throughout breakpoints. On pill and speak to, we will be able to simplify the structure via overriding the desktop configuration.

Pill Grid Settings

Transfer the Visible Builder to Pill view and open the Row’s Format choice staff. Make two adjustments:

  • Set Selection of Columns to 2.
  • Exchange the Offset Worth on each Grid Offset Laws from 2 to 1 on the pill breakpoint.

Atmosphere Row Span to 1 at the 6n+1 rule and Column Span to 1 at the 6n+6 rule successfully neutralizes the desktop masonry impact on pill.

The focused pieces nonetheless fit the foundations. Alternatively, they span an identical quantity as each different merchandise. The result’s a cleaner 2-column grid the place each and every merchandise occupies an identical quantity of area.

Telephone Grid Settings

Transfer to Telephone view and set Selection of Columns to 1. You probably have no longer overridden the pill offset values once more on telephone, the ones pill values will proceed downward thru Divi’s responsive inheritance.

Each and every merchandise now stacks vertically in one column.

A Construction Template provides you with a robust start line. The Format choice staff exposes the settings the template applies. Since the ones settings can also be adjusted throughout breakpoints, you’ll use extra complicated Grid layouts on desktop and simplify them for smaller monitors.

Wrapping Up

CSS Grid in Divi 5 makes it more uncomplicated to construct layouts that may were tough to create with usual column constructions by myself. On this lesson, the similar six Columns of content material have been reshaped 3 other ways the usage of row-level Grid controls.

First, we implemented a elementary Construction Template. Then, we used a template with Grid Offset Laws. In the end, we created a masonry-style template with responsive overrides.

The place To Use This Subsequent

You’ll be able to lengthen the similar way in lots of instructions. Bins can turn into grids. Construction Templates provide you with examined beginning issues. Grid Offset Laws flip position-based good judgment into reusable patterns that may proceed running as extra youngster pieces are added.

That final level is particularly helpful for dynamic content material and Loop Builder layouts, the place the collection of pieces would possibly trade over the years.

In Phase 12: Making Your Divi 5 Site Absolutely Responsive, we’ll take the whole thing constructed up to now and refine it throughout breakpoints. That comes with the Flexbox layouts from Phase 10, the CSS Grid layouts from this section, typography, spacing, and templates.

The objective is to make the whole website dangle up from large desktops to small telephones.

The publish Part 11: Mastering CSS Grid In Divi 5 seemed first on Elegant Themes Blog.

WordPress Maintenance Plans | WordPress Hosting

read more

0 Comments

Submit a Comment

DON'T LET YOUR WEBSITE GET DESTROYED BY HACKERS!

Get your FREE copy of our Cyber Security for WordPress® whitepaper.

You'll also get exclusive access to discounts that are only found at the bottom of our WP CyberSec whitepaper.

You have Successfully Subscribed!