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

Responsive four card feature section [NextJS, TypeScript, TailwindCSS]

next, react, typescript, tailwind-css
Kenny Ng•400
@kennylun123
A solution to the Four card feature section challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


Hi everyone, this is my solution of "Four card feature section". This is my first time of using TypeScript and TailwindCSS. I want to ask a question about setting up the grid layout for desktop version in TailwindCSS. I can only use the original way to apply grid-area in global.css.

/* How to achieve below style in TailwindCSS? */
@media (min-width: 1024px) {
  .home__cards-wrapper {
    grid-template-areas:
      "card1 card2 card4"
      "card1 card3 card4";
    align-items: center;
  }

  .card:nth-of-type(1) {
    grid-area: card1;
  }

  .card:nth-of-type(2) {
    grid-area: card2;
  }

  .card:nth-of-type(3) {
    grid-area: card3;
  }

  .card:nth-of-type(4) {
    grid-area: card4;
  }
}
/* END: Card styles */

How would you set up the grid layout for cards of desktop version with TailwindCSS?

Any comment will be appreciated. Thanks for your help!! :D

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 Kenny Ng'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