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

Single price grid component using SASS and BEM

Larsβ€’ 35

@languagelars

Desktop design screenshot for the Single price grid component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


  1. My button bounced on hover, was shaky so to speak. I think I was able to fix it with backface-visibility: hidden; is this the best approach to doing so?
  2. Should I have used Flexbox to position the 'price per month' next to the number? I've used position absolute.

Community feedback

Connor Zβ€’ 5,115

@zuolizhu

Posted

Hey Lars,

Nice work on this solution! The animation on the button hover is very cool πŸ‘. To answer your questions:

  1. I haven't see the shaky when I turn off backface-visibility: hidden; It might be caused by the cubic-bezier. You can watch how your cubic-bezier looks like in hereπŸ‘‰ https://cubic-bezier.com/

  2. There is nothing wrong to use position: absolute; once you remember to set the parent (card__pricing) to position relative. However, I would set top: 50%; transform: translateY(-50%); to the text 'per month' to make it centered vertically.

To use the flexbox, just set card__pricing display to flexbox, and depends on your flavor, you can set card__pricing align items to center, or set card__paragraph align-self to center.

Here is my favorite flexbox cheat sheet, https://yoksel.github.io/flex-cheatsheet/ hope these can help.

Happy coding!

2

Larsβ€’ 35

@languagelars

Posted

@zuolizhu Hello zuolizhu. Thank you very much for your detailed comment, highly appreciate it! After restarting my browser the shakiness was gone, idk why it happened. Yes, it could be because of the cubic-bezier. I've added top: 50%; and left: 50%; and transform: translate(-50%, -50%) now and indeed it is perfectly centered now. Flexbox I tried as well and might even be a better solution, true.

1

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