Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted almost 2 years ago

Responsive 3-column card using Grid

Alina•170
@electr0space
A solution to the 3-column preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hello amazing community! 🎉

Would like to share the results of my struggle to make CSS Grid works. 🤓 It was quite a challenge for me to make it work since there is a lot of tricky things with Grid. But I'm pretty satisfied with the final work. And I've definitely learnt a lot:

  • how to plan your work if you use Grid: how many columns and rows you'll need, their sizes, what units to use and why, use grid-area or grid-row and grid-column etc.

  • finally feel confident using grid-row and grid-column;

  • how to center vertically and horizontally grid container (the most time I spent was trying to figure out how to place it in the center of the viewport). My solution was to add 1fr on top and bottom of the container and on the left and right with fixed height for the container:

.container {
        height: 100vh;
        margin: 0;
        grid-template-columns: 
            1fr repeat(3, minmax(150px, 20.5rem)) 1fr;
        grid-template-rows: 1fr auto 1fr;
    }

What is your solution for placing the grid container in the center of the viewport?

  • in addition to Grid, I've set another goal which is to learn more how relative units and how they work;
  • practice a little bit with pseudo classes (such as :nth-child());
  • and it was my first try of mobile-first approach, which I definitely liked!

What did you practice on this challenge?

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Alina's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License