Single Price Grid component (Grid and Flex)
Design comparison
Solution retrospective
Hi all , i am not satisfied with my result. I need to understand more about positioning and how dimensions works. Any advise? Thanks for your time
Community feedback
- @AdrianoEscarabotePosted almost 2 years ago
Hi Michael Kanios, how are you? I really liked the result of your project, but I have some tips that I think you will enjoy:
A good practice to center content is using
grid
orflex-box
, avoid using margin or padding to make placements, use only in the latter case! we can do it like this:Flex-box:
body { display: flex; align-items: center; justify-content: center; flex-direction: column; min height: 100vh; }
GRID
body { display: grid; min height: 100vh; place-content: center; }
The rest is great!
I hope it helps... 👍
Marked as helpful0@MichaelKaniosPosted almost 2 years ago@AdrianoEscarabote Thank you very much for your great and helpfull response.
0 - @rubenaoPosted almost 2 years ago
Hey Michael Kanios :), I see your code and I have a suggestion for center the component:
-
You can use display: grid; place-items : center; to center the component. Before that you need to set width: 100% and min-height: 100vh to the body selector
-
You can use display:flex ; justify-content: center ; align-items:center . Before that you need to set width: 100% and min-height: 100vh to the body selector
Hope that this help you. Well done! Happy coding :)
Marked as helpful0 -
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