QR Component Desktop version using HTML and CSS

Solution retrospective
What are the best practices for writing clean CSS code? What is the best way to centre a div?
Please log in to post a comment
Log in with GitHubCommunity feedback
- @dorian-edwards
If a div has a width < 100% or < 100vw you can use "margin: 0 auto" to center it as well. the 0 sets the margin along the y axis, top and bottom, to 0, and auto will put enough margin on either side of your div along the x axis to set it in the middle of the screen.
The div element is block level by default so this works, if you override the display of your div and make it inline or inline-block, this will no longer work.
- @CreatorLZ
Hi. Nice work!. To center a div I generally use this syntax; display:flex; align-items:center justify-content: center
- @DoriseneO
this is nice.i think you should have increased your font-size a little.
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