Product Overview Card Component

Solution retrospective
Hello, I would like feedback on the following problems I encountered during this challenge:
- How to position the card correctly without an overflow even when making the page mobile responsive.
- Make sure the card repositions itself correctly on various screen sizes not just mobile.
Thank you!
Please log in to post a comment
Log in with GitHubCommunity feedback
- @lealee92
Hello, great job !
- You can put overflow: hidding on your body or parent
- You can check out Kevin Powell course on responsive layout (free), he helps me a lot with css. I recommend to start with mobile first, it's easier (https://www.youtube.com/watch?v=0ohtVzCSHqs&t=452s&ab_channel=KevinPowell) putting a max-width helps a lot too;
- @MelvinAguilar
Hi @gabrielkyalo 👋, good job on completing this challenge! 🎉
Here are some suggestions you might consider:
Update your flexbox properties to center it correctly:
body { background-color: hsl(30, 38%, 92%); font-family: 'Fraunces', serif; font-family: 'Montserrat', sans-serif; display: flex; justify-content: center; align-items: center; min-height: 100vh; /* padding: 10% 25% 30% 25%; */ /* margin: auto; */ margin: 0; padding: 20px; } @media only screen and (max-width: 628px) { body { /* width: 100%; */ /* height: 100%; */ /* display: block; */ /* justify-content: center; */ /* padding: 10% 0% 20% 0; */ /* overflow-x: hidden;*/ } }
- Try to use semantic tags in your code. Click here for more information.:
With semantic tags:
<body> <main class="container"> . . . </main> <footer class="attribution"> . . . </footer> <body>
-
In this challenge, you should not use the background property to set the image because this image has semantic meaning. Use the CSS background property if the image is not part of the content.
-
You can use a <picture> tag when you need to change an image in different viewports. Using this tag will prevent the browser from loading both images, saving bandwidth and preventing you from utilizing a media query to modify the image.
Example:
<picture> <source media="(max-width: 628px)" srcset="./images/image-product-mobile.jpg"> <img src="./images/image-product-desktop.jpg" alt="your_alt_text"> </picture>
I hope those tips will help you.
Good job, 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