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

NFT preview card component

@Impodays

Desktop design screenshot for the NFT preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Finally did it after struggling 5+ hours. Please review and comment. I would like to know the CSS best practices. Put a comment if there is any alternative or best approaches I should follow when design a this kind of card design. I was confused between CSS flex and grid during the project as I was unable to choose when to use grid or flex. Any advice is highly appreciated.

Community feedback

Vanza Setia 27,795

@vanzasetia

Posted

Hi, Kalhara Sandaruwan! 👋

About flexbox and grid, in general, you want to use flexbox to handle a one-dimensional layout (column or row). Use grid for two-dimensional layout (column and row).

For example, I would make the card-footer as a flex container instead of a grid container. It's because the layout is a one-dimensional layout (row).

One suggestion I have is to use either hr element or set border-top on the card-footer element to create the line. (It is just a preference)

I hope you find this useful!

Marked as helpful

1

@Impodays

Posted

@vanzasetia thank you for such great suggestions.

1
Lucas 👾 104,420

@correlucas

Posted

👾Hello Kalhara Sandaruwan, congratulations for your new solution!

Here's one tip to improve the card responsiveness improving the pricing section. You can create a media query to save space in the pricing section to make each information in a different row. Here’s the code for this media query.

@media (max-width: 350px) {
.info-bottom {
    display: flex;
    row-gap: 10px;
    flex-direction: column;
}
}

You’ve used <div> to wrap the card container, in this case you need to use <main> since this is the main block of this page.

✌️ I hope this helps you and happy coding!

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