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

Product preview card component with plain html / css

P

@EugeneCarbado

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

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?

Community feedback

Lucas πŸ‘Ύβ€’ 104,420

@correlucas

Posted

πŸ‘Ύ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 its width as max-width: 100px (its the container size) and display: 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!

1

P

@EugeneCarbado

Posted

@correlucas I don't use grid as much as I should but I'll definitely give it a go for the next solution. Thanks a lot for the feedback and the tip Lucas πŸ‘πŸΎ

1
Lucas πŸ‘Ύβ€’ 104,420

@correlucas

Posted

@EugeneCarbado You're welcome, is since a month that I'm using Grid, I used to hate grid in the past. Now I like a lots hahaha

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