Product Preview Card Component - using pure HTMS & CSS
Design comparison
Solution retrospective
I would love any constructive feedback, positive or negative, but would especially welcome comments on:
- Does the code seem to conform to best practices?
- Are there ways to shorten my CSS to make its loading faster or more efficient?
- Are my methods systematic and understandable, or would more notes be helpful in a file of this size
Thank you for your help. Happy new year, everyone!
JTG
Community feedback
- @VCaramesPosted almost 2 years ago
Hey there! 👋 Here are some suggestions to help improve your code:
- The image’s
alt tag
description needs to be improved upon ⚠️. Assume that you are describing the image to a someone over the phone.
More Info:📚
https://www.w3.org/WAI/tutorials/images/
- This component requires the use of two images 🎑 at different breakpoints ⚠️. The
picture
element will facilitate this.
Here is an example of how it works: EXAMPLE
Syntax:
<picture> <source media="(min-width: )" srcset=""> <img src="" alt=""> </picture>
More Info:📚
https://www.w3schools.com/html/html_images_picture.asp
- The only heading ⚠️ in this component, is the name of the perfume; “Gabrielle Essence Eau De Parfum” . The rest of the text should be wrapped in a
paragraph
element.
- Currently, the old price (169.99) 🏷 is not being properly announced 😢 to screen readers. To fix this, you are going to wrap the the price in a
del
element and inside it you will add aspan
element with ansr-only class
that will state something like “The previous price was…” and use CSS to make it only visible to screen readers.
More Info:📚
If you have any questions or need further clarification, feel free to reach out to me.
Happy Coding! 🎆🎊🪅
Marked as helpful0@jguleserianPosted almost 2 years ago@vcarames Thank you for the awesome feedback. I remember learning some of these concepts in the past, but I had forgotten about them. This is a great reminder.
With regard to your comment about making "Gabrielle Essence Eau De Parfum" the only heading element, I am curious about the reasoning for this. My thought was that the word "PERFUME" at the top of the card is a "type" or "category" of product and so needed more attention. Is the reasoning behind leaving it as a paragraph that a screen reader will announce it differently or out of order (since the "PERFUME" is a lower level heading) if not? Or, is it just considered a best practice since "Perfume" is not a subcategory of "Gabrielle..."?
I appreciate you taking time to look through my code and helping me make it better. I am also grateful for the links you provided.
Have a wonderful new year! Jeff
0@jguleserianPosted almost 2 years ago@vcarames Thank you for the awesome feedback. I remember learning some of these concepts in the past, but I had forgotten about them. This is a great reminder.
With regard to your comment about making "Gabrielle Essence Eau De Parfum" the only heading element, I am curious about the reasoning for this. My thought was that the word "PERFUME" at the top of the card is a "type" or "category" of product and so needed more attention. Is the reasoning behind leaving it as a paragraph that a screen reader will announce it differently or out of order (since the "PERFUME" is a lower level heading) if not? Or, is it just considered a best practice since "Perfume" is not a subcategory of "Gabrielle..."?
I appreciate you taking time to look through my code and helping me make it better. I am also grateful for the links you provided.
Have a wonderful new year! Jeff
1@VCaramesPosted almost 2 years ago@jguleserian
Glad I could help! 😁 Happy New Year as well!
This component would be part of larger site. So the user would have already navigated to the "perfume" section of the site, so having the "perfume" as a heading makes no sense (Think Sephora or Macys).
1 - The image’s
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