QR component using CSS Flexbox and Google Fonts

Solution retrospective
I found difficult using flexbox when the flex-direction
is set to column
. Not that sure if flexbox is the only way to position the QR Component in the center of the screen. I've heard of margin: auto
but couldn't make it work. Feedback is absolutely welcome!
Please log in to post a comment
Log in with GitHubCommunity feedback
- @MelvinAguilar
Hello there 👋. Good job on completing the challenge !
I have some suggestions about your code that might interest you.
-
Using
display: flex;
is a very common way to center elements. Another alternative is to use thegrid
layout.body { display: grid; min-height: 100vh; place-items: center; }
Another way to center an element is using
display: absolute
but it may introduce issues on smaller devices. The component might overflow or cause layout problems.If you choose to use
margin: auto;
for centering, keep in mind that it won't center vertically, only. For vertical centering, you can use flexbox with margin: auto:body { display: flex; min-height: 100vh; } .item { margin: auto; }
I hope you find it useful! 😄
Happy coding!
Marked as helpful -
Join 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