Grid Cheatsheet
For Divi 5 users

Grid Cheatsheet

Layout is one of the biggest changes from Divi 4 to Divi 5. Sections, rows, columns and groups now have a setting called Layout Style, with three choices. This page covers Grid. It shows you, in plain English, what each grid setting does before you touch it in the builder.

Block

How Divi 4 worked. Each thing stacks under the one before. Pages and layouts brought over from Divi 4 may still use it.

Flex

Lines things up in one direction, side by side or stacked. If they wrap onto a new line, each line is arranged on its own. New pages in Divi 5 start here.

Open the Flexbox Cheatsheet
Grid This page

Lines things up in rows and columns at the same time, like a gallery or a set of pricing cards.

So what is grid?

Think of a muffin tin. Before anything goes in, the tin already has its holes, say three side by side and two rows deep.

Each muffin drops into the next empty hole, from left to right, then onto the next row down. A giant muffin can take up two holes. You can't squeeze a fourth muffin into a row of three, so it goes down to the next row.

Grid works the same way. In Divi, the tin is your section, row, column or group, and each hole is called a cell. You decide the holes first, then everything inside fills them in order.

If you're coming from Divi 4, you already know half of this. Picking a column structure for a row is like deciding how many holes go side by side. Grid adds the rows as well, so things line up from top to bottom as well as from left to right.

How many side by side

How many cells side by side in each row. Anything extra goes onto the next row down.

In Divi: Number Of Columns

How wide each one is

All the same, all one fixed size, or your own pattern, such as two-thirds and one-third.

In Divi: Column Width

How much room one takes

One block can take up two or more cells side by side, or two or more rows.

In Divi: Column Span and Row Span

An easy way to look at it

With flexbox, the layout starts from the modules. Each one takes up the room its content needs, and the row adjusts to fit them.

With grid, the layout starts from the grid. You set the columns and rows first, and each module goes into the next empty cell.

The alignment settings are simpler in grid. Justify always moves things left and right. Align always moves things up and down. Unlike flexbox, they never swap.

Settings ending in Items move each block inside its own cell. Settings ending in Content move all the cells together inside the grid.

Flexbox or grid?

Here are the same five cards, set to three per line both ways. Look at the bottom line.

Flex Each line is sized separately

Cards 4 and 5 share their line between them, so they grow wider than the cards above. Great when things should size to their content. Annoying when they're meant to line up.

Grid The columns stay put

Cards 4 and 5 sit under cards 1 and 2, exactly the same width, and the last cell stays empty. Everything lines up from top to bottom as well as from left to right.

The quick test

Ask one question: do these need to line up in one direction, or two? If they only sit side by side, or only stack, that’s flexbox. That’s true even when they wrap onto more lines, because flexbox arranges each line on its own. If they must line up in rows and columns at the same time, that’s grid.

Still unsure? Leave it on Flex, which is where Divi starts. Switch to Grid the moment you catch yourself fiddling with widths to make the last row line up.

What you're buildingUseWhy
Logo on the left, menu on the rightFlexSide by side, and each part should be the size of its content.
A row of buttons, or an icon beside a headingFlexSide by side again. Buttons with different wording should be different widths.
Modules stacked inside a column or cardFlexA single stack. Flexbox can also push the last module to the bottom.
Services, team photos, pricing cards, a galleryGridEverything needs to line up in rows and columns, including the last row.
One big featured tile with smaller tiles around itGridOnly grid lets one module take up two rows and two columns.
A strict pattern, such as two-thirds text, one-third imageGridThe column widths stay fixed, whatever the content.
A card grid where every button sits level at the bottomBothGrid on the row to line the cards up. Flex inside each card to push its button down.

Try it before you build it

The grey area below is your grid, and the lettered blocks are what goes inside it: the columns in a row, or the modules in a column or group. The settings on the right use the same names as Divi 5. Click one and watch what happens. The box under the grid tells you what you're seeing and why. Click a block to change settings for that block on its own.

The blocks are different sizes on purpose, just like real modules. A short heading, a tall image and a button are rarely the same size on your page. Here you can see how each setting treats them.

This playground is easiest to use on a tablet or computer, where you can see the settings and the results side by side. On a phone, the settings scroll in their own box just under the blocks.

What you're seeing

Show the code behind this (optional)

You never need this in Divi. The builder writes it for you. It's here if you're curious.

Grid settings

Design tab, Layout in Divi, with Layout Style set to Grid

Scroll this panel for more settings. The grid stays where it is.


Block B on its own

Click any block to pick it. In Divi, these live in that column's own settings.


The settings at a glance

Divi settingIn plain EnglishWatch out for
Layout StyleChoose Grid to turn on everything on this page. Works on sections, rows, columns and groups.The grid settings only appear once Grid is chosen.
Number Of ColumnsHow many cells side by side in each row. Anything extra starts a new row.Set it separately for tablet and phone. Three side by side rarely fits a phone.
Column WidthEqual Width shares the width evenly. Equal Minimum Width sets a smallest size. Equal Fixed Width locks every column to one size. Auto Width sizes each column to what's in it. Manual Width lets you type your own pattern.In Manual, fr is short for fraction, meaning a share of the width. 2fr 1fr splits the width into three equal shares: two for the first column, one for the second.
Row HeightsAuto height lets each row fit its tallest block. Equal height makes every row the same. Minimum, Fixed and Manual give you more control.Fixed height can cut off anything taller than the row.
Horizontal and Vertical GapThe space between columns, and between rows.Adds space between blocks only, not around the outside.
Grid DirectionRow fills from left to right, then moves down a row. Column fills from top to bottom, then moves right.Column only behaves once Divi knows how many rows there are.
Grid DensityDense lets later blocks jump back to fill an empty cell. Auto keeps everything in page order.Divi starts on Dense, so blocks can appear out of order once anything takes up two cells.
Justify ItemsWhere each block sits, left to right, inside its own cell.Stretch (the default) fills the cell. A block with a fixed width won't stretch.
Align ItemsWhere each block sits, top to bottom, inside its own cell.Only shows when the cell is taller than the block.
Justify ContentMoves all the columns together, left and right, inside the grid.No empty space means no visible change. Equal Width columns always fill the full width.
Align ContentMoves all the rows together, up and down, inside the grid.Needs the grid to be taller than its rows.
Collapse Empty ColumnsRemoves columns that have nothing in them.Handy when a module is hidden on one device and leaves a gap.
Grid Auto Columns and RowsThe size of any extra columns or rows Divi has to add when blocks don't fit the ones you set.If extra ones appear unexpectedly, check your spans first.
Column Span and Row SpanOn a single column. How many cells it takes up, side by side or top to bottom.A Column Span bigger than Number Of Columns makes Divi add a column.
Column and Row Start and EndOn a single column. Pins it to an exact spot, counting the lines between columns from 1.Three columns have four of those lines, counting the outside edges. Start 1, End 3 covers the first two.
Justify Self and Align SelfOn a single column. Lets it ignore Justify Items or Align Items.Same rules as above, for that one column only.
Grid Offset RulesGives blocks a span or position by pattern from the grid, such as the first item, the last item, or every third.Quicker than editing each block, but harder to spot later. Give each rule an Admin Label.

Common layouts and what to choose

Every layout here uses grid, because the modules need to line up in rows and columns at the same time. When they only need to sit side by side or stack, like a menu or a pair of buttons, that's a job for flexbox. See the Flexbox Cheatsheet.

Cards that stay in their columns

  • Number Of Columns3
  • Column WidthEqual Width Columns
  • Horizontal and Vertical GapSame value

Then switch to tablet view and set Number Of Columns to 2, and to 1 on phone.

One big featured tile

  • Number Of Columns3
  • Row HeightsEqual height
  • First column: Column Span2
  • First column: Row Span2

Or add a Grid Offset Rule targeting First Item, so the layout holds even if you swap things round.

Two-thirds and one-third

  • Number Of Columns2
  • Column WidthManual Width Columns
  • Pattern2fr 1fr

fr is short for fraction. 2fr 1fr gives the first column two shares of the width and the second one share, so you get two-thirds and one-third. On phone, set Number Of Columns to 1 so the narrow side drops underneath.

Level buttons on a card grid

  • Row: Layout StyleGrid
  • Row: Align ItemsStretch
  • Each card: Layout StyleFlex
  • Each card: Direction and JustifyColumn, Space Between

Grid makes the cards line up and match heights. Flex inside each one pushes the button to the bottom.

A heading across the top of the cards

  • Number Of Columns3
  • Column WidthEqual Width Columns
  • Heading's column: Column Span3

The heading stretches over all three columns and the cards fill the row below. On phone, set Number Of Columns to 1 and the heading's Column Span back to 1, or the grid adds extra columns to fit it.

One image beside three features

  • Number Of Columns2
  • Image's column: Row Span3
  • Row HeightsAuto height

The image fills the left side for all three rows, and each feature sits in its own row beside it. Put the image first. On phone, set Number Of Columns to 1 and Row Span back to 1 so the image sits on top.

"I clicked it and nothing happened"

  • My blocks changed order on their own

    Grid Density is on Dense, which Divi uses to start with. Once a block takes up more than one cell, later blocks jump back to fill the gaps. Set it to Auto to keep page order.

  • An extra column appeared

    A Column Span is bigger than Number Of Columns, so the grid adds a column to make room. Lower the span, or add a column on purpose.

  • Align Items does nothing

    The blocks already fill their cells from top to bottom. Give the grid a height or min height, use Equal height rows, or put blocks of different heights in the same row.

  • Justify Content does nothing

    The columns already fill the full width, so there's no empty space to move them into. It only shows up with fixed or auto width columns.

  • Grid Direction Column looks broken

    Filling from top to bottom only works when the grid knows how many rows to fill. Set the number of rows, or switch back to Row.

  • It looks right on desktop, crammed on phone

    Number Of Columns doesn't change by itself. Set it again in Divi's tablet and phone views, and check any spans there too.

Moving from Divi 4 to Divi 5?

If you want to migrate to Divi 5 with confidence, and get to grips with the new interface and new features, have a look at Rocking Divi 5.

Find out about Rocking Divi 5
Not sure if you need flex or grid? See Flexbox or grid? above, or take a look at the Flexbox Cheatsheet. Divi setting names checked against Elegant Themes' own guides: Understanding every grid setting in Divi 5, Mastering column and row grid parameters and Understanding Divi's CSS grid layout.