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-main

asmaa 110

@asmaaHasbo

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Community feedback

Lucas 👾 104,580

@correlucas

Posted

👾Hello @asmaaHasbo, Congratulations on completing this challenge!

Your solution its almost done and I’ve some tips to help you to improve it:

1.Use <main> instead of a simple <div> this way you improve the semantics and accessibility showing which is the main block of content on this page. Remember that every page should have a <main> block and that <div> doesn't have any semantic meaning.

2.Use relative units as rem or em instead of px to improve your performance by resizing fonts between different screens and devices. These units are better to make your website more accessible. REM does not just apply to font size, but to all sizes as well.

3.Use the THE PICTURE TAG that is a shortcut to 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 tag picture 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 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 of 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>

4.Add the website favicon inserting the svg image inside the <head>. <link rel="icon" type="image/x-icon" href="./images/favicon-32x32.png">

👨‍💻Here's my solution for this challenge if you wants to see how I build it: https://www.frontendmentor.io/solutions/product-preview-card-vanilla-css-and-custom-hover-state-on-hero-85A1JsueD1

✌️ I hope this helps you and happy coding!

Marked as helpful

0

asmaa 110

@asmaaHasbo

Posted

@correlucas okay , thank you very much :) , I will do what you said,thank you again

0
Phoenix243 310

@PhoenixMputu

Posted

Sorry if my English is not correct, I am French -speaking. Very good solutions, but your solution is a bit minimalist. You have positioned your card very well in the center but there is not the mobile version. I don't know if you didn't do it because you don't think it was important or because you used Grid and it complicated you to adapt it to mobile. If this is the case you could use Flexbox.

Marked as helpful

0

asmaa 110

@asmaaHasbo

Posted

@PhoenixMputu my english isn't very good too , frist thank you , i didn't do mobile verison because i couldent handel the img tag in mobile version

0
asmaa 110

@asmaaHasbo

Posted

@PhoenixMputu my english is bad too , thank you very much :) , i didn't do mobile version because i didn't know how to handel the img tag

0

@VCarames

Posted

Hey @asmaaHasbo, some suggestions to improve you code:

  • The Alt Tag Description for the image needs to be improved upon. You want to describe what the image is; they need to be readable. Assume you’re describing the image to someone.

  • This challenges requires you to use two images for different breakpoints. To properly achieve this, you want to use <picture> element.

Syntax:

  <picture>
    <source media="(min-width: )" srcset="">
    <img src="" alt="">
  </picture>

Source:

https://www.w3schools.com/html/html_images_picture.asp

https://web.dev/learn/design/picture-element/

  • There is only one heading in this challenge and that is the name of the perfume, “Gabrielle Essence Eau De Parfum”.

  • The old price is not being announced properly to screen readers. You want to wrap it in a Del Element and include a sr-only text explaining that this is the old price.

  • Your content is not responsive. Here is a Google Developers link that will teach you how to do so.

https://web.dev/learn/design/

  • Why did you comment out your media query?

Happy Coding! 👻🎃

0

asmaa 110

@asmaaHasbo

Posted

@vcarames thank you for this advices , i will do it , i commented media query because i didn't know how to handle img tag in mobile version , but i will see the picture tag

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