Product preview card component using flexbox and vanilla CSS
Design comparison
Solution retrospective
How can I improve my CSS to follow best practices? Which libraries or frameworks would make this challenge easier or more efficient?
Community feedback
- @GelcimarMoraesPosted about 2 years ago
Hi, @hydrx Congratulations on finishing this project. 🎉🎊You have a great solution there!
Here are my suggestions for you:
- Something you can do to improve the image that needs to
switch between mobile desktop and use
<picture>
instead of<img>
inside a div. For reasons of SEO difficulty and search engines like Google and b localization, it is not a good practice to import this product image with CSS as this will cause an image of the image in google. You can manage both as inside the<picture>
tag and use the html to set when images should, configure themax-width
device moved from the device (mobile/desktop) Here is a guide on how to usepicture
: w3schools
- The element
embed
must not appear as a descendant of thebutton
element.
I would build the button like this:
<button class="btn"><img src="images/icon-cart.svg" width="25" height="15" alt="shopping cart icon">Add to Cart</button>
w3schools✌️ I hope this helps you and happy coding!
Marked as helpful1@ticiadevPosted about 2 years ago@GelcimarMoraes Thanks so much for your feedback! I updated my code with your suggestions, and will continue to keep them in mind for future projects.
1 - Something you can do to improve the image that needs to
switch between mobile desktop and use
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