Responsive Testimonial Grid Layout

Please log in to post a comment
Log in with GitHubCommunity feedback
- @MarziaJalili
Fantasticoo! 💯
✅ Using the
grid-template-areas
can be a very concise approach, man. And, for naming the element you can the:nth-child()
selector. You are asked to provide it the placement of the element in html.✅ In order for
grid-template-areas
property to work, you are required to set thegrid-area
in each testimonial element.- Take the code below as an example for html:
<ul class="testimonial-parent"> <li class="testimonial">(the details of the Denail)</li> <li class="testimonial">(the details of the Janathan)</li> <li class="testimonial">(the details of the Jeanette)</li> <li class="testimonial">(the details of the Pattric)</li> <li class="testimonial">(the details of the Kira)</li> </ul>
It is better to use the
ul
andli
elements cause they somehow represent a list, bro.- Then, apply the code below in css:
/* give each child element a name for grid-area */ .testimonial:nth-child(1) { grid-area: one; } .testimonial:nth-child(2) { grid-area: two; } .testimonial:nth-child(3) { grid-area: three; } .testimonial:nth-child(4) { grid-area: four; } .testimonial:nth-child(5) { grid-area: five; } /* set the grid-template-areas on the parent element*/ /* for mobile */ .testimonial-parent { display: grid; gap: 1rem; grid-template-areas: "one" "two" "three" "four" "five" ; } /* for tablet */ @media (min-width: 30em) { .testimonial-parent { grid-template-areas: "one one" "two three" "four four" "five five" ; } } /* for desktop */ @media (min-width: 60em) { .testimonial-parent { grid-template-areas: "one one two five" "three four four five" ; } }
You're solution is flawless though!
😁😁😁
Marked as helpful
Join 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