Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted over 3 years ago

Product preview card component | CSS Grid | Flexbox | Javascript

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

Solution retrospective


  1. I was having sizing issues with the images when i was trying to place the images using CSS e.g.
 .image-original-dt {
        background-image: url(.images/image-product-desktop.jpg)
  }

I removed the images from the CSS and instead placed them directly into the HTML

<img src="./images/image-product-desktop.jpg" alt="bottle of Gabrielle Essence Eau De Parfum" class="image-original-dt">

Which of the methods of placing images is best practise ? Placing images into HTML or CSS?

  1. I'm not sure if my Javascript is best practise. I made a function that toggles a class on click. Is there a better way of doing it or is my code correct ?

Any feedback is welcome!

Thanks, Shane

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 User9511'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