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 Overview Card Component

@gabrielkyalo

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


Hello, I would like feedback on the following problems I encountered during this challenge:

  1. How to position the card correctly without an overflow even when making the page mobile responsive.
  2. Make sure the card repositions itself correctly on various screen sizes not just mobile.

Thank you!

Community feedback

Léa 10

@lealee92

Posted

Hello, great job !

  1. You can put overflow: hidding on your body or parent
  2. 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;
2

@gabrielkyalo

Posted

@lealee92 Thank you, I will check him out!

0

@MelvinAguilar

Posted

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;*/
 }
}

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!

1

@gabrielkyalo

Posted

@MelvinAguilar Thank you so much and yes the tips definitely helped!

1

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