Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 11 months ago

Product preview card component

Samira•150
@gely25
A solution to the Product preview card component challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


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

The most difficult part for me was making the image responsive. From the beginning, I chose to use the <picture> tag to add <source> elements and specify breakpoints. However, when using the browser's developer tools to test different sizes, the image sometimes overflowed or got compressed. Despite setting the container's width to 100%, using object-fit: cover, and trying Flexbox, I still couldn't make the image fully depend on its parent and adapt properly. In the end, I gave the parent container a fixed height for the desktop version and tried to make it fit the image's height, although I don't feel it's a good practice.

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

I would like to know how I can improve, if there is a way to fix it, or if maybe I did something wrong that altered the image's behavior.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Samira's solution.

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

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner
  • Use cases

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License