Design comparison
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
- @maciejkrol18Posted over 2 years ago
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 buttondisplay: 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 smallgap
to the button itself (for examplegap: 10px;
- in case you haven't heard ofgap
, it's a flexbox property defining a gap between every item in a flex container)Marked as helpful0 - @iamenochleePosted over 2 years ago
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 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