Product Preview Card Component using HTML5, CSS and JS
Design comparison
Solution retrospective
Had a bit of a mess for the image implementation as I was using background-image CSS property. I hope that I have used it correctly. Any suggestions are welcomed.
Community feedback
- @MavreonPosted over 2 years ago
Hello Fricis, congratulations completing this challenge🎉. Based on your concerns, Yes! it's okay to use the
background-image
property, I also used it when I executed this challenge so no worries on that end. Also, I noticed your text$169.99
is not centered, so I looked into your code and found out you setalign-items: flex-start
instead ofalign-items: center
. I think you nailed the rest of the design for the most part. Happy coding 🚀Marked as helpful2 - @joaojgabrielPosted over 2 years ago
Using
background-image
is fine, but you should consider using the<img>
element for semantics (i.e. because the image is part of the actual content), accessibility, so it can have analt
attribute and arguably use the <picture> element for load time and bandwidth. Anyhow, good job! Don't let these considerations or perfectionism stun you. First get it done, then get it right, then get it optimized. :)Marked as helpful1@GFJankavsPosted over 2 years ago@joaojgabriel Nice tip regarding <picture> tag! Just recently read about it in W3Schools HTML lessons and now will have an actual use case for it. Thank you!
1
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