I have a three-column layout for containers that works fine on Desktop and Tablet view but breaks incorrectly on Mobile view.
The layout on mobile should stack like this
The way it stacks now is: 1,4,7,2,5,8,3,6,9.
Is there a way to do this without introducing the masonry library?
I could do it in Javascript by adding a listener for resizing and reloading the containers in a different order but I believe it is not optimal.
The columns have currently the following code:
<div data-component-hook-blog-function="blogColumn" data-sly-list.blog="${blogList}" class="l-grid__cell l-grid__cell--1/3 l-grid__cell--1/1@phone">
.l-grid__cell--1\/3 {
width: calc(3.3333333333 * calc(10% - var(--rounding-compensation)) - var(--size-gutter-x));
-webkit-box-flex: 0;
-ms-flex: 0 0 auto;
flex: 0 0 auto;
}
.l-grid__cell {
-webkit-box-flex: 1;
-ms-flex: 1 0 auto;
flex: 1 0 auto;
margin-left: var(--size-gutter-x);
margin-bottom: var(--size-gutter-y);
-webkit-box-sizing: border-box;
box-sizing: border-box;
}