Maximum grid layouts fill each to be had mobile. Leaving some cells empty can create a extra fascinating composition, with house that guides the attention in the course of the content material. With CSS Grid in Divi 5, Grid Offset Regulations allow you to place pieces exactly and go away decided on cells unoccupied.
On this instructional, we’ll construct 4 playing cards on an eight-column grid. Each and every card begins farther to the correct and spans fewer columns, making a stepped space of empty house alongside the left.
Why Use Offset Regulations As a substitute Of Spacers?
Spacers, margins, and column spans can all create empty house, however they provide you with various kinds of regulate.

An empty Team Module can act as a spacer. On the other hand, should you upload it as an immediate little one of the grid container, it additionally counts as a grid merchandise. Placing it sooner than a card adjustments that card’s place within the collection, which is able to have an effect on laws focused on pieces by means of index.
A left margin provides house beside an merchandise, however a set price reminiscent of 240px does no longer keep aligned with grid tracks because the container width adjustments.
Column spans regulate what number of tracks an merchandise covers, whilst alignment positions it inside of its assigned grid space. To specify precisely the place that space starts, use a get started price.
Grid Offset Regulations mix those controls. As an example, Card 2 can get started at column line 3 and span 6 columns. The 2 columns sooner than it stay empty, with out including a spacer.
Set Up The Segment
Upload a Segment, then insert a Row the usage of the Unmarried Column Flex Construction Template. Go away the Row’s Format Taste set to Flex when you construct the playing cards. This provides you with room to regulate their content material and styling sooner than making use of the grid composition.
Set the Segment’s Background Colour to #F0EDE4 and its CSS ID to paintings. We’ll use #paintings as the cardboard button’s instance hyperlink later.
Construct The Card
Each and every card might be a Team Module inside of its personal Column. Once we transfer the Row to Grid, the ones Columns will transform the grid pieces.
Upload a Team Module throughout the first Column and set its Component Label to Card 1. Follow those settings:
- Background Colour: #FAF8F5
- Border: 1px cast #D8D8D0 on both sides
- Border Radius: 6px
- Padding: 2.25rem on both sides
- Overflow: Hidden
- Format Taste: Flex
- Format Course: Row
Upload two extra Team Modules throughout the card. The primary will cling the textual content; the second one will cling the button and outsized quantity.
Set the primary internal Team’s Format Taste to Flex, its Format Course to Column, and its hole to 0.75rem.
Inside of it, upload a Textual content Module for the eyebrow label, a Heading Module, and every other Textual content Module for the frame reproduction. Set the heading to Heading 2 at 30px. Set the frame textual content to 16px and its Max Width to 590px.
Position The Button And The Quantity
Set the second one internal Team’s Format Taste to Flex and its Format Course to Column. Then observe:
- Measurement: Develop to Fill
- Justify Content material: House Between
- Align Pieces: Finish
For the reason that outer card makes use of a Row route, Develop to Fill shall we this Team soak up to be had horizontal house. House Between separates the button and quantity vertically when there may be spare peak, whilst Align Pieces: Finish aligns them to the correct.
Inside of this Team, upload a Button Module. Use an arrow glyph as its textual content and set its background to #FAF8F5.
Unlink the Border Radius values. Set Best Left to 0 and the opposite 3 corners to 50% to create a leaf-shaped button.
Beneath Border, set Button Border Width to 1px, Button Border Colour to #1D3B2E, and Button Border Taste to Cast.
Regulate the arrow’s dimension and colour underneath Textual content. Flip Display Button Icon off so Divi does no longer upload every other icon beside the arrow. Beneath Sizing, set each Button Width and Button Top to 2.5rem.
Set the button’s hyperlink to #paintings for this case. For a are living challenge, substitute it with the related vacation spot.
Within the Attributes choice crew, upload an Aria Label that describes the hyperlink’s objective, reminiscent of View our paintings. An arrow by myself does no longer obviously keep up a correspondence the vacation spot to display reader customers.
Upload The Outsized Quantity
Underneath the button, upload a Textual content Module for the cardboard quantity. Set its textual content dimension to 76px and its Opacity to 0.15.
The second one Team’s format puts the quantity underneath the button and aligns it to the correct. The cardboard’s Overflow: Hidden atmosphere clips any content material that extends past its obstacles.
For Card 1, we’re the usage of the eyebrow 01 / FEATURED PROJECT, the heading The Lengthy Desk Lawn, and a brief frame description. The outsized quantity repeats 01.

Reproduction The Card
End styling Card 1, then reproduction its Column thrice. This assists in keeping every card inside of a separate direct little one of the Row.
Replace every card’s label, heading, frame reproduction, and quantity. Follow those settings to the corresponding card Teams:
- Card 2: CSS ID method; Background Colour #1D3B2E
- Card 3: CSS ID services and products; Background Colour #9FAF8D
- Card 4: CSS ID touch; Background Colour #C85B38
Regulate the textual content and button colours to care for readable distinction in opposition to every background. Give each CSS ID a novel price, entered with out the # prefix.
Stay the Columns at complete width and the Row’s wrapping enabled whilst enhancing so the playing cards stay stacked.
Transfer The Row To Grid
Open the Row’s Design → Format settings and observe:
- Format Taste: Grid
- Selection of Columns: 8
- Selection of Rows: 4
- Grid Auto Columns: 1fr
- Grid Course: Column
- Horizontal Hole: 0px
- Vertical Hole: 0px
The playing cards would possibly glance compressed sooner than we upload their placement laws. Subsequent, we’ll give every card its personal row, beginning place, and column span.
With each gaps set to 0, the playing cards will meet vertically. The unoccupied cells to their left will create the stepped composition.

Upload The First Offset Rule
To find Grid Offset Regulations in the similar Format choice crew and click on Upload Grid Offset Rule. For an advent to the container settings, see How To Create A Grid Layout In Divi 5.
The rule of thumb conversation contains an non-compulsory Admin Label, a Goal Offset, and fields for column and row placement.
Regulations goal the Row’s direct kids of their supply order. On this format, the ones kids are the 4 Columns containing our playing cards.
Set Goal Offset to Customized nth-child Rule and input 1 within the box underneath it. This objectives the primary Column. Input:
- Column Span: 8
- Column Get started: 1
- Row Get started: 1
Go away Column Finish, Row Span, and Row Finish unset.
Get started values seek advice from grid strains; spans rely the tracks between them. Beginning at column line 1 and spanning 8 columns makes Card 1 duvet the entire grid width.
Construct All 4 Card Offset Regulations
Upload 3 extra laws, focused on pieces 2, 3, and 4. Your 4 laws must use those values:
- Card 1 — nth-child 1: Column Span 8, Column Get started 1, Row Get started 1
- Card 2 — nth-child 2: Column Span 6, Column Get started 3, Row Get started 2
- Card 3 — nth-child 3: Column Span 5, Column Get started 4, Row Get started 3
- Card 4 — nth-child 4: Column Span 4, Column Get started 5, Row Get started 4
Go away the opposite placement fields unset for every rule.
All 4 playing cards finish on the proper fringe of the grid. Card 2 leaves two empty columns at the left, Card 3 leaves 3, and Card 4 leaves 4. This creates the stepped form with out including empty components.
You’ll be able to additionally organize the playing cards visually the usage of Divi 5’s CSS Grid Editor. Click on Open Grid Editor within the Row’s settings, then transfer and resize the pieces to check the location above. Test the ensuing laws to substantiate their get started and span values.

Make The Playing cards Presentable On Cellular
Preview the format on Pill and Telephone. The desktop placement leaves much less room for every card’s content material because the display narrows, particularly within the fourth card.
To retain the stepped composition, get started by means of adjusting the content material inside of every card. On the Telephone breakpoint:
- Trade the outer card Team’s Format Course to Column so its two internal Teams stack vertically.
- Scale back the cardboard’s Padding from 2.25rem to 1.75rem.
- Scale back the heading dimension from 30px to 26px.
- Scale back the frame textual content dimension from 16px to 15px.
The video underneath displays those content material changes on Card 1. Repeat them on Playing cards 2, 3, and four, since adjustments made after duplication don’t robotically observe to the opposite copies.
If the narrower playing cards nonetheless really feel cramped, simplify the grid placement too. Grid Offset Rule values can also be overridden responsively. For a full-width stack on Telephone, set the Row’s Selection of Columns to 1, then set each rule’s Column Get started and Column Span to 1 at that breakpoint. Stay the 4 Row Get started values at 1, 2, 3, and four.
This preserves the desktop composition whilst giving every card the entire to be had width on Telephone.

Construct A Other Form
The similar controls can create different compositions. Trade the observe rely, beginning positions, and spans to depart a gap throughout the format or a channel of empty cells between teams of content material.

This situation makes use of one rule for every card. If you happen to upload a 5th card, give it a placement rule if it wishes a particular place; in a different way, the grid’s auto-placement settings decide the place apparently. Recheck the objectives every time you insert, take away, or reorder Columns, for the reason that laws observe their positions within the Row.
For extra on adapting the grid to smaller monitors, see How To Master Grid Responsiveness In Divi 5.
The submit How To Use Empty Grid Cells To Create More Interesting Compositions In Divi 5 gave the impression first on Elegant Themes Blog.






0 Comments