Desktop design of product card using css and flexbox
Design comparison
Solution retrospective
I am a newbie to web dev, therefore this took me quite a while to complete. My question is on code refactoring; I think my css code is quite bulky. How then can I make my css code less bulky with regards to this particular project?
Thank you.
Community feedback
- @VCaramesPosted almost 2 years ago
Hey there! 👋 Congrats on completing your first challenge!🎊🍻
Here are some suggestions to help improve your code:
- FEM Best practice ✅, before moving on to the next challenge, always check your FEM report, to see what is incorrect and update your code with it so that you would not make the same mistake over again. This should be the first thing that should be done ⚠️ right after submitting the challenge.
- Every site should always have ✅ a
main
element not only for semantic purposes but also to help assistive technology find the main content of your content. For this challenge, it will wrap the the entire section ⚠️.
More Info: 📚
- 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.
Syntax:
<picture> <source media="(min-width: )" srcset=""> <img src="" alt=""> </picture>
More Info:📚
https://www.w3schools.com/html/html_images_picture.asp
- Do not uppercase ❌ "perfume" in HTML as it is not accessible friendly. Instead you will want to style it in CSS.
- 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@TonyAppiahPosted almost 2 years ago@vcarames This is in-depth and I love it. Thank you so much. I will patiently walk through your feedback in order to get the full understanding of it. I will definitely reach out if I need further assistance. Thanks once again.
0 - Account deleted
You can use the border-radius shorthand for your code. Instead of using
border-top-right-radius: 3%;
andborder-bottom-right-radius: 3%;
you can useborder-radius: 0 3% 3% 0;
According to MDN's documentation (https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius)
When using the border-radius and all four values, they're in the following order: top-left, top-right, bottom-right, bottom-left.
Marked as helpful0@TonyAppiahPosted almost 2 years ago@GenuineMiyashita Thank you very much for the info; another method bagged. Thank you.
0
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