Responsive product card component using Flexbox and CSS Grid
Design comparison
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
- @amalkarimPosted almost 2 years ago
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;
frombody
as it will renderbody
'spadding
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 examplealt="A bottle of Gabrielle Essence Eau de Parfum"
. I don't thinkImage 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 helpful1@carlosmndzgPosted almost 2 years agoHello!
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 - Remove
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