Complex responsive layout

How should I structure this layout? In the desktop version, there are 3 sections within the right sidebar, separated by equal gaps, but in the mobile version, there is just one grid.
No description
15 Replies
MarkBoots
MarkBoots13mo ago
hm, the different sections jump all over the place, in different orders. you could try to do it with grid-template-areas. give each section a grid-name and position them with specific grid-template-areas for your specific media queries Don't know how strict the desgns are, but: - if the hint and analyse could swap places in the mobile view - and on desktop the < > buttons move to in between analyse and next, it could be a bit easier order-wise.
Brandon
BrandonOP13mo ago
Appreciate your reply! Your approach is a great start, but I'm still unclear of how to implement the mix of large and small gaps in the desktop column One approach that I can think of, which I'm sure is not optimal for accessibility, is to separate the layout into a flexbox with 3 sections, and selectively hiding elements when the layout shifts btw, I designed the layout, and I am aware that it's chaotic lol, but I still want to keep things where they are
MarkBoots
MarkBoots13mo ago
Im not able to look at it now (work) but can give it a try later today
Brandon
BrandonOP13mo ago
thanks very much! no rush
glutonium
glutonium13mo ago
a cool way to make this would be using linear-gradient xD but ya looking at the image it seems like it's gonna be a chess board hence divs would be a better choice
MarkBoots
MarkBoots13mo ago
I made a small example of what is possible. You still have to style the different sections ofcourse https://codepen.io/MarkBoots/pen/poGrvGp the layout changes from desktop to mobile < 600px
Brandon
BrandonOP13mo ago
Woah! so cool!
MarkBoots
MarkBoots13mo ago
- desktop view it is a 2 column grid left column: board right column: flex with 3 regions space between - mobile view: 6 column grid with template-areas the right container and regions are made display: content so we can assign all individual parts to that grid
Brandon
BrandonOP13mo ago
thanks! let me digest the code
MarkBoots
MarkBoots13mo ago
no problem. take your time.
Brandon
BrandonOP13mo ago
so the children can follow the parent grid layout even if they are nested several layers deep? wow I had no clue i have never even seen display:contents amazing
MarkBoots
MarkBoots13mo ago
yea, by using display:contents, the container is omitted there is also subgrid that can do this, but it's not stable enough imo
Brandon
BrandonOP13mo ago
Thank you so much!
MarkBoots
MarkBoots13mo ago
you're welcome. make sure you fork or copy the pen if you want to keep it for future reference. I might delete it later
Brandon
BrandonOP13mo ago
Forked!
Want results from more Discord servers?
Add your server