@0xabdulkhaliq
Posted
Hello there 👋. Congratulations on successfully completing the challenge! 🎉
- I have other recommendations regarding your code that I believe will be of great interest to you.
CSS 🎨:
- let me explain, How you can easily center the component.
- We don't need to use
margin
andpadding
to center the component both horizontally & vertically. Because usingmargin
orpadding
will not dynamical centers our component at all states
- To properly center the component in the page, you should use
Flexbox
orGrid
layout. You can read more about centering in CSS here 📚.
- For this demonstration we use css
Grid
to center the component
body {
min-height: 100vh;
display: grid;
place-items: center;
}
- Now remove these styles, after removing you can able to see the changes
body {
grid-template-columns: 1fr;
grid-template-rows: 1fr auto;
grid-template-areas: "content", "footer";
}
.card {
grid-area: "content";
margin-top: 16vh;
margin-left: auto;
margin-right: auto
}
.
I hope you find this helpful 😄 Above all, the solution you submitted is great !
Happy coding!
Marked as helpful
@nattyrice
Posted
@0xAbdulKhalid
Thanks for the help! I had actually just got done working out how to get the flex to work on my own. Yeah, I had a lot of things I'd tried while I was throwing things at the wall to see what stuck. As you'd noticed, some of it was getting in my way. I think I like your grid/place-items recommendation more.