Design comparison
Solution retrospective
I finished this one challenge pretty quickly which I'm really happy about because it means I'm learning, it motivates me.
What challenges did you encounter, and how did you overcome them?Vertically centering the container, did some googling.
Community feedback
- @SecretariatVPosted 4 months ago
Hi, @lalaholmesss. Hope doing well.
Your workig very good.
But have got some implement.
In your project you using margin:auto; top: 50%; for move center your card. Of cource it's correct. But it isn't best solution.
The best solution is using flex or grid on parent tag.
Like this.
This is your code.
.container { width: 400px; margin: auto; border: 1px solid black; background-color: hsl(0, 0%, 100%); position: relative; top: 50%; transform: translateY(25%); border-radius: 20px; box-shadow: 8px 8px black; }
And solution.
<main> <div class="container"> </div> </main>main { width: 100%; min-height: 100vh; or height: 100vh; // One way display: flex; align-items: center; justify-content: center;
//Other way display: grid; place-items: center;
}
I wish you success.
Thanks.
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