Design comparison
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
- @vanzasetiaPosted about 2 years ago
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 setborder-top
on thecard-footer
element to create the line. (It is just a preference)I hope you find this useful!
Marked as helpful1@ImpodaysPosted about 2 years ago@vanzasetia thank you for such great suggestions.
1 - @correlucasPosted about 2 years ago
👾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 GitHubJoin 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