Design comparison
Community feedback
- @VCaramesPosted almost 2 years ago
Hey there! 👋 Here are some suggestions to help improve your code:
- It is best practice ✅ to use,
classes
for styling purposes, while usingids
solely for JavaScript.
- Your
CSS Reset
is being underutilized. 😢 To fully maximize 💯 it, you will want to add more to it. Here are some examples that you can freely use 😁: Josh Comeau Reset Eric Meyer Reset
- To properly center ✅ your content to your page, you will want to add the following to your
body
(this method uses CSS Grid):
body { min-height: 100vh; display: grid; place-content: center; }
More Info: 📚
If you have any questions or need further clarification, feel free to reach out to me.
Happy Coding! 🎆🎊🪅
Marked as helpful1@stefan123283Posted almost 2 years ago@vcarames Thanks for the feedback. I haven't learned yet about CSS Grid Layout, but should I remove the flexbox method to center the product-card-container if I used the CSS Grid method you gave me to center the product-card-container ?
0 - It is best practice ✅ to use,
- @MelvinAguilarPosted almost 2 years ago
Hello there 👋. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
HTML 📄:
-
You could use the
<del>
tag to indicate the price that was before the discount. Additionally, you can use asr-only
class to describe the discount. This will help screen reader users to understand that the price was discounted.Example:
<del><span class="sr-only">Old price: </span>$169.99</del>
-
You can use the
<picture>
tag when you have different versions of the same image 🖼. Using the<picture>
tag will help you to load the correct image for the user's device saving bandwidth and improving performance. You can read more about this here 📘.Example:
<picture> <source media="(max-width: 460px)" srcset="./images/image-product-mobile.jpg"> <img src="./images/image-product-desktop.jpg" alt="{your alt text goes here}"> </picture>
CSS 🎨:
- Instead of using pixels in font-size, use relative units like
em
orrem
. The font-size in absolute units like pixels does not scale with the user's browser settings. This can cause accessibility issues for users who have set their browser to use a larger font size. You can read more about this here 📘.
I hope you find it useful! 😄 Above all, the solution you submitted is great!
Happy coding!
Marked as helpful1@stefan123283Posted almost 2 years ago@MelvinAguilar Thank you very much for the feedback. These tips help me a lot to progress in this field. One thing I want to say is that I used the pixels in the font-size only when I set the text size in the body and then I used rem to change the size of the elements compared to the 14px value in the body. I hope you understood me.
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