Design comparison
Solution retrospective
I don't understand why can't I center this one with body flex...I'm open to suggestions. kindly help.
Community feedback
- @Enmanuel-Otero-MontanoPosted over 2 years ago
Hello Ramkrishn!
Change the minimum height of the "body" to 100vh, I'm pretty sure that's why the container isn't centered.
If you do let me know so I know how it goes.
Cheers!
1@Ram0O7Posted over 2 years ago@Enmanuel-Otero-Montano oh god! this was a really silly mistake. I,ve made several projects before, never had this issue actually I set min-height to 100% instead of 100vh and didn't even notice. thanks for pointing out very much appreciated.
0 - @DavidMorgadePosted over 2 years ago
Hello, I think I can have the solution to your problem.
For this kind of challenges where there is only one component on the center of the screen, give your
html
andbody
awidth: 100%
andheigth: 100%
, then the container will get in the center of the screen, you will have to remove themargin-top: 250px
.Also, I would recommend you to use CSS resets for browsers (every browser has his own styles) you can reset them using for example Normalize.css.
Hope my answer helps you!
0@Enmanuel-Otero-MontanoPosted over 2 years ago@DavidMorgade, hello!
It is not necessary to apply 100% width to the body or the html, since they have it implicitly. The normalize.css thing is correct.
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