I have used CSS Flexbox for centering the QR Code Component
Design comparison
Solution retrospective
I have centered the component using flexbox but I was trying to center without flexbox and apply margin: 0 auto on that container and it gets centered but not from top. Then tried to center using margin: auto auto , but this is also not worked. If anyone has a solution without using flexbox please provide.
Community feedback
- @SamadeenPosted over 2 years ago
Hey!! Cheers 🥂 on completing this challenge.. .
Here are my suggestions..
- You should use <main class="container"> instead of <div class="container">.
This should fix most of your accessibility issues
. Regardless you did amazing... hope you find this useful... Happy coding!!!
Marked as helpful0@prakash-naikwadiPosted over 2 years ago@Samadeen thank you , I will do this in next project
0 - @BLADEHEDAPosted over 2 years ago
Hello normally margin 0 auto centers only from the top. of you want to center vertically and horizontally as you're saaying, you can either use flex-box (align-items: center , justify-contents: center) or can use [ position: absolute ,top :50%, left:50% transform: translate(-50%,-50%). other alternatives exist but these are the best approaches in my regards . nice work though.
Marked as helpful0@prakash-naikwadiPosted over 2 years ago@BLADEHEDA thank you for your solutions and this position : absolute solution just solve my another project problem also, thank you against...
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