one does not work (columns stay in columns . I parametered the grid with 3 rows and 1 columns, and normal setup is display:grid 1 row, 3 columns) https://codepen.io/steve-koch/pen/KKPMPje (Link 2)
I might be struggling to understand what you’re trying to do, but you have different code for the .container class, which is why it doesn’t work for the second link. To answer your question, yes, grid is compatible with media queries.
Also, you should try to avoid mixing grid and flex because it’s confusing for other developers. For the first link, if you want the blocks to stack below 900px, you should add this to your media query instead:
Yes you did understand what i wanted to achieve: wrap columns into rows when screen size is smaller(and having these blocks of an equal size also)
ok for the tip for the flex and not mixing grid and flex (though i dont get why we can’t mix both) LINK 1
for LINK 2, i understand that once a container grid is setup, i cannot change the setup of the grid on a media query. I can only adjust the elements inside the grid.
Though i saw this example where the grid is redefined with the grid-template function.
Does it work because in the original css block .wrapper there is no parameters on the size and column sizing?
It’s confusing for other developers, and yourself. You’re changing an entire display property to something else, which may cause headaches down the road for everyone involved. It’s best to stick to one solution if you can.
The second link doesn’t work because you’re defining each block to be a column.
#block-1 {
grid-column: 1; // Delete this
grid-row: 1; // Add this
}
It’s confusing for other developers, and yourself. You’re changing an entire display property to something else, which may cause headaches down the road for everyone involved. It’s best to stick to one solution if you can.
Ok i get it. Do not mix to have clean code, readable easily.
Thank you for the link, i’ve learned from this. Seeing better how it works.
I added a grid-auto-rows:1fr; in addition to keep rows of an equal height in the media query