Reverse Loop Layout Columns

Intermediate

CSS

Machine

Details

This Divi Machine code snippet introduces a dynamic way to reverse the column order in loop layouts at specified intervals. This allows for flexible column arrangement changes in the Divi Machine Archive Loop module using simple CSS. Ideal for enhancing your website’s layout with a touch of creativity.

Snippets Demo

Divi Machine Loop Columns After Reverse Divi Machine Loop Columns Before Reverse

Code

1

Description:
This CSS will reverse the columns.

Language: CSS

Where to add: Divi Theme Options

                        /* Divi Engine Reverse Every nth Loop Columns in Divi Machine */
.de-reverse-columns .divi-filter-archive-loop .dmach-grid-item:nth-child(2n) .et_pb_row { /* This will reverse every 2nd loop, change 2n to 3n for every 3rd loop etc */
    display: flex; /* Sets column layout to flex */
    flex-direction: row-reverse; /* This reverses the columns */
}
                    
2

Description:
If you have margin added to your columns that are uneven, this code will reverse that uneven margin also.

Language: CSS

Where to add: Divi Code Module

                        /* If you are using columns that have margins, we need to reverse these too */
.de-reverse-columns .divi-filter-archive-loop .dmach-grid-item:nth-child(2n) .et_pb_row .et_pb_column:nth-child(1) {
    margin-right: 0 !important;
}

.de-reverse-columns .divi-filter-archive-loop .dmach-grid-item:nth-child(2n) .et_pb_row .et_pb_column:last-child {
    margin-right: 5.5% !important;
}
                    

Related Snippets

Explore more from Divi Engine