Design comparison
Solution retrospective
grid-template-areas
did not respond to media query changes. However after switching from grid template to basic grid properties everything worked as intended.
Community feedback
- @vinshieldPosted almost 4 years ago
Hi,
I too faced challenges when trying to implement media queries while using grid-template-areas. It's possible to do though. Here's what my solution looked like:
@media (max-width: 500px) { .container { margin: 20% auto; grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "item1" "item2" "item3" "item4" "item5" ; } }
You can see the full thing here: https://www.frontendmentor.io/solutions/responsive-testimonial-section-using-gridbox-cNd0zW1f-
Cheers!
1 - @ospopPosted almost 4 years ago
I think
grid-template-columns: 1fr
enabledgrid-template-areas
to work in your case. I only updatedgrid-template-areas
in my media query. I will try this next time I use grids. Thanks for the input!0
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord