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

@Gehad28

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?

  1. I think I'll try using an empty div with a background image to change the image from the desktop one to the mobile one instead of using two `` tags with display: none;.

  2. I also may try mobile-first workflow.

Community feedback

@bccpadge

Posted

Hello @Gehad28. Congratulations on completing this challenge!!!🎉

To change the product image you can do it in index.html file using the <picture> tag

Example:

<picture>
  <source media="(min-width:650px)" srcset="images/image-product-desktop.jpg">
  <img src="images/image-product-mobile.jpg">
</picture> 

Be sure to add descriptive alt text improves accessibility and screen readers will say the alt text below in the example for people who blind and or visually impaired.

Example: alt="Gabrielle Essence Perfume bottle laying down with a green leaf above and below it">

More info📚:

To improve your index.html file, make sure you use HTML Semantic Tags

Add to cart text should be wrapped in <button> because users are clicking on the <button> to trigger an action to do something

Using a <div> on the website does not explain any of the content

Here is my solution to this challenge: Product preview card component

I hope you find this useful and don't hesitate to reach out if you have any questions

Marked as helpful

1

@Gehad28

Posted

@bccpadge

Thank you so much. This is really helpful.

0
geomydas 1,060

@geomydas

Posted

Don't use background images for things like this. You can use display: none to change but it is much more better to use the <picture> tag. The thing I said here is the same as what Rebecca said

Marked as helpful

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