Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Responsive product card component using Flexbox and CSS Grid

Carlos 110

@carlosmndzg

Desktop design screenshot for the Product preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Is the responsive component implemented the right way? Is there a better way in the button to align both the cart icon and "Add to cart" string instead of using flexbox?

If you have any tips I would be grateful!

Thank you in advance!

Community feedback

@amalkarim

Posted

Hi Carlos 👋

I think it's best using flexbox to align the cart icon and text "Add to cart". I can't think of another solution. Using grid would be overkill.

I don't know what to say. Your solution is close to perfect to be honest. But if you really want to take the extra mile, try this:

  • Remove height: 100vh; from body as it will render body's padding useless when the screen height is shorter than the card. Even the top part of the card will be hidden from the page.
  • alt="Image of Gabrielle Essence Eau de Parfum" could be replaced by a more describing text, for example alt="A bottle of Gabrielle Essence Eau de Parfum". I don't think Image of is needed here. Check this article on w3schools for the explanation.
  • Instead of using text-decoration: line-through; for <span class="card__real-price">$169.99</span>, you can use <s>$169.99</s> to give them more meaning. Read more about <s> tag element here

Hope this helps. Happy coding!

Marked as helpful

1

Carlos 110

@carlosmndzg

Posted

Hello!

First of all thanks for your comment, I appreciate a lot the time you spent writing all those advices. :D

I actually didn't know how the messages inside alt's attributes were as well as the existence of the <s> attribute, using that element is easier than styling with CSS and it is also semantic!

Thank you very much, it helped a lot!

Have a nice day!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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