Design comparison
Solution retrospective
How is the best way to center a div ? How is my mobile design implementation? What is the best approach for this challenge?
Community feedback
- @elaineleungPosted over 2 years ago
Hi Ceejay, welcome to Frontend Mentor, and congrats on completing your first challenge! It looks great, and well done on making it responsive. Just wanted to quickly answer your question about centering a div: the easiest way is to use
display:grid
on the parent container, and it's common to see this on the body tag for the FEM projects, like this:body { display: grid; place-content: center; min-height: 100vh; }
The
min-height
on the body tag is very important because it tells the browser how tall the container is, and that's how it would know how much space to put around the container.Hope this helps!
Marked as helpful0
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