1

I'd like to build a Grid with Flexbox that contains 2 Objects per row. These Objects should be centered along a vertical coloumn and have different widths (as on the picture). Does anyone have an Idea how to approach it?

enter image description here

I'd like to use flexbox to be able to swith on to 1 Object per row and keep the correct order. Otherwise I would have nested divs and alligned the objects with

left:0;

or

right:0;

but then I wouldn't be able to keep the order on mobile. Is there any way to achieve this?

m0meni
  • 16,006
  • 16
  • 82
  • 141
vinni
  • 633
  • 2
  • 8
  • 32

1 Answers1

0

So to get this working I used masonry.js I built a grid with 2 grid_items per row at 50% width. Then I inserted the Boxes into the grid_items and gave them float:right / float:left.

Css:

.grid {
width: 100vw;
}

.grid-item { 
width: 50%; 
margin-bottom: 30px;
background-color:grey;
}
vinni
  • 633
  • 2
  • 8
  • 32