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

product preview card component

Salvinas 30

@Salvinast

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


Hey, the icon and the text on the button are not centered. I was wondering maybe I should somehow use flexbox to fix it. What do you think?

Community feedback

Fancy 320

@maciejkrol18

Posted

Yes, you can easily fix it with flexbox. On the other hand, why is the cart icon outside of the button? Remove the transform: translate(46px, 36px); from the cart icon and get it inside of the button. Then apply following styles to the button

display: flex;
align-items: center;
justify-content: center;

This way everything will be centered, but the icon will be sticked to the 'Add to cart' text. You can fix it by either applying a small margin-right to the image or applying a small gap to the button itself (for example gap: 10px; - in case you haven't heard of gap, it's a flexbox property defining a gap between every item in a flex container)

Marked as helpful

0

Salvinas 30

@Salvinast

Posted

@FancyBaguette Thanks, updated!

0
enochlee 600

@iamenochlee

Posted

nice!, try adding a position of relative to span.notDiscounted, then use bottom of 5px to align it to the center

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