Design comparison
Solution retrospective
I didn't create a mobile version of the site, the desktop one barely looks normal as it is, even though it's quite different from the example image.
What are some things that I did right?
What are some things that I did wrong?
This is my first time completing a challenge so I welcome any and all advices as well as criticism.
Community feedback
- @damiandev22Posted about 2 years ago
Hello, I want to congratulate you for this proposed solution that you have given. It has turned out quite well, however there are some details that you can improve.
1- I would like to recommend you to make measurements to the proposed design to achieve a result as close as possible to the real one. I do it with Photoshop, so you can start with the card being 600px wide and 500px tall.
2- Use units as rem or em instead of px to improve your performance by resizing fonts between different screens and devices. To save your time you can code your whole page using px and then in the end use a VsCode plugin called px to rem here's the link → https://marketplace.visualstudio.com/items?itemName=sainoba.px-to-rem to do the automatic conversion or use this website https://pixelsconverter.com/px-to-rem
3- Use css reset to have a good starting point, e.g. https://piccalil.li/blog/a-modern-css-reset/. However, if you don't use it, it would be good if you declared in the body box-sizing:border-box; so that the card always stays the same size as you declare and does not grow when an element has padding.
4- The left and right sections are half the width of the card. you can declare it with width:50%.
5- They ask you for an image for desktop and another for mobile. You can solve that with the picture tag. THE PICTURE TAG let's you deal with the multiple images in this challenge. So you can use the <picture> tag instead of importing this as an <img> or using a div with background-image. Use it to place the images and make the change between mobile and desktop, instead of using a div or img and set the change in the css with display: none with the picture tag is more practical and easy. Note that for SEO / search engine reasons isn't a better practice import this product image with CSS since this will make it harder to load the image. Manage both images inside the <picture> tag and use the html to code to set when the images should change setting the device max-width depending on the device desktop + mobile.
Check the link for the official documentation for <picture> in W3 SCHOOLS: https://www.w3schools.com/tags/tag_picture.asp
See the example below:
<picture> <source media="(max-width:650px)" srcset="./images/image-product-mobile.jpg"> <img src="./images/image-product-desktop.jpg" alt="Gabrielle Parfum" style="width:auto;"> </picture>Here's my solution for this challenge if you want to see how I build it: https://www.frontendmentor.io/solutions/solution-to-product-preview-card-component-UynGgj6mJ0
Those are some of my suggestions. I hope it helps you.
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin 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