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 component

@feroztia

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


Hey guys! For me, it was a bit difficult at first to understand, how to change the image in desktop and mobile versions. Anyway, here's my solution for this challenge, it was pretty fun.

Community feedback

Jesus 190

@Galindezpro

Posted

De la manera que escribistes las imagenes:

            <img id="desktop-img" src="/images/image-product-desktop.jpg" 
            alt="chanel 
            gabrielle 
            perfume">
           <img id="mobile-img" src="/images/image-product-mobile.jpg" 
           alt="chanel gabrielle 
           perfume">
</div>```


debes eliminar "/" al principio y el css puedes usar "DISPLAY: NONE" en una de las imagines para ocultarla, cuando uses el media query y debas cambiar de imagen le aplicas el "DISPLAY: NONE" para ocultar la imagen que se estaba mostrando y "DISPLAY: INLINE-BLOCK" para mostrar la imagen oculta

Marked as helpful

0

@ratul0407

Posted

@feroztia congratulations on completing this challenge🎉🎉

It's great but you can make it even better:

  • first you images aren't loading up because of the wrong source try this as the source ./images/image-product-desktop.jpg and the same goes for the mobile image as well
  • To change the image for mobile and desktop versions you can do this
<picture>
<source srcset = "./images/image-product-desktop.jpg" media="(min-width:600px)">
<img src="./images/image-product-mobile.jpg>
 </picture>

It will display the mobile image as default. But when the screen size increases to 600px or above the desktop image will load up✌

I hope it was helpful for you👍👍

Happy coding🙂🙂

Marked as helpful

0

AziraalDev 100

@AziraalDev

Posted

Hi! Try to update your repo and use "./" instead of "/" at the beginning of path for images.

Marked as helpful

0

@feroztia

Posted

@AziraalDev Thanks a lot!

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