Product preview card component with plain html / css

Solution retrospective
I have used 2 different sets of div tags for the headers and articles for mobile states and desktop states so the content displays according to the viewpoint. How would you do this differently using less code?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @correlucas
👾Hello Eugene, congratulations for your new solution!
I did this same projects a month ago, the way you did is working perfectly. I'll say you the way I did mine, just to know an alternative way to build the same solution. There's no right or wrong, the solution needs only to work.
In this case I've used grid to build the structure with 2 columns and all you need to do is create a main block to hold all the content (you can use
<main>
to wrap), set itswidth
asmax-width: 100px
(its the container size) anddisplay: grid
/grid-template-column: 1fr 1fr
(this means that your component will have two columns with 50% of the container width each thats 500px).Then for the column structure, the second column I've used flexbox to the alingment and gap to separate vertically each element.
👋 I hope this helps you and happy coding!
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