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 with HTML and CSS

Giorgi 200

@siduki

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


Hello everyone. I already done another work. It's my first responsive, please check my code and if some advice, don't hesitate.

Community feedback

Lucas 👾 104,420

@correlucas

Posted

👾Hello Giorgi, Congratulations on completing this challenge!

I saw your solution preview site and I think it's already really good. Here’s some tips for you to improve it:

1.A better way to work this solution image, the product image is by using <picture> to wrap it on the html instead of using it as <img> or background-image (with the css). Using <picture> you wrap both images (desktop and mobile) and have more control over it, since you can set in the html when the images changes setting the screen size for each image.ote that for SEO / search engine reasons isn’t a better practice import this product image with CSS since this will make it harder to the image.

2.Think about using relative units as rem or em instead of px to improve your performance by resizing fonts between different screens and devices.Anyhow, if we want a more accessible website, then we should use rem instead of px. REM does not just apply to font size, but to all sizes as well.

3.Use a CSS reset to avoid all the problems you can have with the default CSS setup, removing all margins, making the images easier to work, see the article below where you can copy and paste this css code cheatsheet: https://piccalil.li/blog/a-modern-css-reset/

✌️ I hope this helps you and happy coding!

Marked as helpful

0

Giorgi 200

@siduki

Posted

@correlucas Thank you for your feedback.

I already use CSS reset, just margins, paddings and box-sizing, will consider your suggestion for future.

About relative units, I have still some confusing, I think it will disappear with practice.

1
Lucas 👾 104,420

@correlucas

Posted

@siduki You can code your entirely solution with px and in the convert all to rem with a VSCode plugin called px to rem this way you don't need to convert each unit and do it automatically. Keep it up =)

Marked as helpful

0
Giorgi 200

@siduki

Posted

@correlucas BIG BIG THANKS :) I think it works :) can you please check code one more time?

0
Lucas 👾 104,420

@correlucas

Posted

@siduki Now I can see the rem units this is nice, now you miss only the image to be responsive and dont distort.

The image is not responsive yet, a quick way to make any image responsive and respecting the container size is to add display: block and max-width: 100% to the <img> selector. To improve the responsiveness even more adding the auto-crop property you can add object-fit: cover to make the image crop inside the container its inside.

img {
    display: block;
    object-fit: cover;
    max-width: 100%;
}
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