Product-preview-card

Solution retrospective
Finally had time to do a quick little challenge again. Forgot how much fun that can be. Im not really proud of the centering with this one but flexbox was making some problems and as long as it works it works i guess. Would love to hear what you guys have to say regarding my solution!
Please log in to post a comment
Log in with GitHubCommunity feedback
- @MelvinAguilar
Hello there 👋. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
center
- You have used the mobile first approach, for your component on mobile devices you have set a maximum width of 24.5rem, but for desktop you did not modify that maximum, so it is correctly centered on the horizontal axis but all its content is overflowing.
.container { margin-top: 8rem; max-width: 24.5rem; /* This value never changes. */ . . . } @media screen and (min-width: 1024px) .container { display: flex; flex-direction: row; /* In this place you should modify the maximum width so that it occupies enough for the content.:*/ max-width: 600px; /* Example values, change it*/ }
- To center an element vertically, you should use a height to its container. In this case it is recommended to use "min-height: 100vh" so that it occupies 100% of the viewport height. e.g.: `
main { display: flex; justify-content: center; align-items: center; min-height: 100vh; /* Add this */ }
I hope you find it useful! 😄
Happy coding!
Marked as helpful
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