Product card using flexbox and media queries for responsive design
Design comparison
Solution retrospective
I learnt how to keep things simple while solving this challenge. I learnt how to align an icon and text in a button using "vertical-align: middle;"... Pls your feedback is well appreciated. What can I do improve this code
Community feedback
- @VCaramesPosted about 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 to better describe what it is. You will want to assume that you are describing the image to a someone.
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
- 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.
- Implement a Mobile First approach 📱 > 🖥
With mobile devices being the predominant way that people view websites/content. It is more crucial than ever to ensure that your website/content looks presentable on all mobile devices. To achieve this, you start building your website/content for smaller screen first and then adjust your content for larger screens.
If you have any questions or need further clarification, feel free to reach out to me.
Happy Coding! 🍂🦃
1@DoyeDesignsPosted almost 2 years ago@vcarames thank you for this detailed feedback. I will make the corrections.
From what I understand adding the sr-only class will make the old price(169.99) not to be visible to users but, only screen readers. But in the design it’s meant to be visible.
0@VCaramesPosted almost 2 years ago@DoyeDesigns
Glad I could help.
The
span
along with thesr-only
class, will contain something like “The previous price was…”. This will be the only thing that will hidden visually. The price will still be visible.So it should look something like this:
<del> <span class="sr-only">the old price was</span> $169.99 </del>
1@DoyeDesignsPosted almost 2 years ago@vcarames noted.
I understand now. Thanks much for this feedback
0@DoyeDesignsPosted almost 2 years ago@vcarames This is the code I used
<p class="old-price"> <del> <span class="sr-only">The old price was</span>$169.99 </del> </p>THE CSS .sr-only { position:absolute; left:-10000px; top:auto; width:1px; height:1px; overflow:hidden; } is there a better way to do this... i also read its good to use this with sr-only-focusable
0@VCaramesPosted almost 2 years ago@DoyeDesigns
You will want to hide it in this manner (I suggest making it part of your reset, since it is something you will consistently use): https://a11y-guidelines.orange.com/en/web/components-examples/accessible-hiding/
The class name doesn’t matter. You can give any name you prefer. Just make that it implies that it’s only for screen reader purposes.
0@DoyeDesignsPosted almost 2 years ago@vcarames thanks for the resource you've been a huge help.
0 - 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