Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Responsive testimonial section using Sass

@laura-nguyen

Desktop design screenshot for the Testimonials grid section coding challenge

This is a solution for...

  • HTML
  • CSS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


What are you most proud of, and what would you do differently next time?

I utilized grid-template-areas to create the perfect grid layout for the desktop view. I also timed myself while working on this component and was able to complete it in 1.5 hours, which was faster than I had anticipated. I chose to time myself in order to improve my time management skills and practice working under pressure.

What challenges did you encounter, and how did you overcome them?

The cards don't have the same height as each other so initially the grid looked very jumbled. I fixed this by setting the height to 100% on the cards.

What specific areas of your project would you like help with?

I would love to learn another efficient way to achieve this grid layout.

Community feedback

P
tediko 6,680

@tediko

Posted

Hello @laura-nguyen! The reason why you need to explicitly set height to 100% on the cards is because of how you set your grid container in first place. The fr unit allows us to define grid tracks as fractions of the available space which means if a grid container has 2 rows with 1fr each, they will each take up an equal amount of space, i.e., each row will be 50% of the available space. You're defining grid-template-rows: repeat(2, 1fr); so both of your rows take up equal amount of space, and since your first row card content is bigger than second row cards it will still divide them with equal amout of space leaving second row with cards jumbled as you said. Instead what you want to use is min-content keyword which is the smallest size a box can take without overflowing its content - like so: grid-template-rows: repeat(2, min-content). This way, your second row will be as small as your largest card in that row. Now you can remove height: 100% from .card container and from .card--5 where you set height: 100% and auto within some breakpoint. Last thing you need to do is remove align-items: flex-start because it is doing excatly what you want to avoid. align-items: flex-start aligns items to be flush with the start edge of their cell and instead you want to fill the whole width of the cell with align-items: stretch. But since stretch is default behaviour (align-items: normal) you don't have to explicitly set that, just remove old property.

Since you're using display: grid for <main> on desktop you should be consistent and also use grid on mobile instead of flex. Why switch between the two if one can do excatly the same?

Have fun!

Marked as helpful

0

@laura-nguyen

Posted

@tediko Thank you so so much!!!! :)

0

Please log in to post a comment

Log in with GitHub
Discord logo

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