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

Jackson-zablon15โ€ข 100

@Jackson-zablon15

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


What are you most proud of, and what would you do differently next time?

I'm proud to make the card responsive to both mobile view and desktop view

What challenges did you encounter, and how did you overcome them?

I had a problem on changing the image on desktop preview in the @media and i overcome it by using content: url()

What specific areas of your project would you like help with?

I would like help on squeezing the header to make it align exactly as in design, i tried using right padding but didn't work. I would like help on removing the scroll bar on mobile preview, i tried to set the height of body to fit content but didn't work

Community feedback

Dylan de Bruijnโ€ข 3,190

@DylandeBruijn

Posted

@Jackson-zablon15

Hiya! ๐Ÿ‘‹

Congratulations on your solution, it looks very close to the design! I can tell you put a lot of effort into it.

Things I like about your solution ๐ŸŽ‰

  • Use of semantic HTML elements
  • Clear descriptive CSS classes
  • Use of CSS custom properties

Things you could improve โœ๏ธ

  • I suggest adding a bit of padding to your body element so the card has some space around it on smaller viewports.

  • You could add a min-height: 100vh to your body element so it takes up the full height of the viewport while still being able to grow when the content inside it grows.

  • Try using using relative CSS units like rem and em they make your layout more adaptable.

  • Be careful with setting a fixed width and height on your elements. If the content in these elements grows beyond these restrictions youโ€™ll run into overflow issues. Keeping the height at auto - which block elements are by default - will be fine in most cases.

  • Try styling your elements using classes instead of IDโ€™s. Most of the time they are the better choice. IDโ€™s are mostly used to select elements using JavaScript, navigation on the page itself and to style unique elements.

  • You donโ€™t have to wrap your image in a separate div, itโ€™s possible to style it directly to achieve the same result.

  • Try using the picture element and making your solution more responsive.

I hope you find my feedback helpful! ๐ŸŒŸ

Let me know if you have more questions and I'll do my best to answer them. ๐Ÿ™‹โ€โ™‚๏ธ

Happy coding! ๐Ÿ˜Ž

Marked as helpful

0

Jackson-zablon15โ€ข 100

@Jackson-zablon15

Posted

@DylandeBruijn Thank you so much for the help. I'm going to use your tips and i know i will learn alot from them.

0
Rui-Martins23โ€ข 150

@Rui-Martins23

Posted

Hi @Jackson-zablon15, Not sure if this may help, but try giving on the @media ccs part, 50% width to both "image" and <section>. This way both parts will only ocupy half of the container <main>, and I think you can then use padding as were you were trying to, on the <section> part.

Concerning the scroll bar, you can use the following on the body element: body ::-webkit-scrollbar { display: none; }

Enjoy coding!

Marked as helpful

0

Jackson-zablon15โ€ข 100

@Jackson-zablon15

Posted

Hi @Rui-Martins23, Thank you for your help especially that part of scroll bar, I'm happy to learn it. Enjoy coding too!

0
imranhossainemiโ€ข 245

@imranhossainemi

Posted

Great work! Your use of css variable and build approach mobile first well-thought-out. Some minor mistake here and there in the work, but I think you will fix it as you learn in the future. Good luck.

0

Jackson-zablon15โ€ข 100

@Jackson-zablon15

Posted

@imranhossainemi Thank you so much

0
Jason Limasโ€ข 50

@jasonlimas

Posted

Hey! Awesome work! It looks really good! However, I think you are having a minor problem with the desktop version. There's a little gap at the bottom of the picture. I had this problem too. I fixed it and the fix might work for you too.

Here's how you can do it: by setting display: block on either your .image class or your img selector. This might be the solution to the little gap at the bottom of the image.

Good luck for your future Frontend development journey! Hope you are having a lot of fun!

0

Jackson-zablon15โ€ข 100

@Jackson-zablon15

Posted

@jasonlimas Thank you for noticing that problem. I will try your solution and try to learn from it.

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