Design comparison
SolutionDesign
Solution retrospective
Please provide your comments on my way of placing div to center.
Community feedback
- @MelvinAguilarPosted 12 months ago
Hello there ๐. Good job on completing the challenge !
-
Utilize
place-items: center
in CSS grid to centrally align content both vertically and horizontally. This eliminates the need for additional styling on the<main>
tag.body { ... min-height: 100vh; display: grid; /* align-content: center; */ place-content: center; } .main { /* display: flex;*/ /* justify-content: center;*/ /* align-items: center;*/ }
place-items
is a shorthand property that combines two properties:align-items
andjustify-items
. It sets the alignment of items in both the block (vertical) and inline (horizontal) directions.
I hope you find it useful! ๐
Happy coding!
2 -
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