How to achieve this style

I want to create an style like in the picture, should i use grid or flex? how?
No description
6 Replies
vince
vince7mo ago
I'd personally use flex. Flex parent container. Each column is another flex container. n + 1 / odd child containers in parent flex container have a margin top. Use media queries to adjust for mobile (or desktop if mobile first)
EIO
EIO7mo ago
I agree with @vince, however, I really love grid for this. Here's a Pen of how I achieved it with grid: https://codepen.io/eioluseyi/pen/GRaKpRq It's responsive, so you can shriink the view to test it.
Rägnar O'ock
Rägnar O'ock7mo ago
That wouldn't work with the mobile view shown on the right A grid for the layout and a translateY on every odd elements in a media query for "desktop" would work tho And it would require less markup
vince
vince7mo ago
Ohhh I see now
Lloyd Peterson
Lloyd PetersonOP7mo ago
thank you @vince , @EIO and @Rägnar for your help, Aprreciated! I already achieve the style.
ZNP
ZNP7mo ago
If you wanna see my version here it is: https://codepen.io/Ziphour/pen/VwOZbJZ
Z
CodePen
VwOZbJZ
...
Want results from more Discord servers?
Add your server