Design comparison
SolutionDesign
Solution retrospective
How do I center the main container vertically? Please explain why the method you say works, that way I can understand when that method should be used.
Community feedback
- @enescengilPosted over 1 year ago
You need to give height to your parent element which is
body
in this code. So you can give the style down below.body{min-height: 100vh;}
Now you should be able to align vertically. Don't forget to remove
margin-top
frommain-container
class. š«µMarked as helpful1
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