Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

QR Code Component

Arnoldβ€’ 10

@arnoldd98

Desktop design screenshot for the QR code component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


Is this the best way to center a div?

Community feedback

Rebecca Padgettβ€’ 1,760

@bccpadge

Posted

Hello @arnoldd98. Congratulations on completing this challenge!!!πŸŽ‰

When I build projects, I use CSS Grid on the body to center content on the webpage.

body{
 display:grid;
 place-content:center;
 min-height: 100vh;
}
  • I suggest you stick to classes rather than Ids when styling elements in CSS. Ids are used for JavaScript.

More infoπŸ“š:

#qr-code {
    max-width: 100%;
    max-height: 100%; /*Remove this style its unnecessary */
    display:block;  /*Add this style and removes all the white space*/
    border-radius: 15px;
}

Hope this helps you

Marked as helpful

2

Arnoldβ€’ 10

@arnoldd98

Posted

thanks for the tips @bccpadge

0
Jereβ€’ 150

@chungvuiloong

Posted

For my projects,

Firstly I create a div, this the the container for contents. Then I add the classes flex, flex-columns, then justify-center as css. This usually does the centering for me for me.

Let me know if it does it for you too

1

Arnoldβ€’ 10

@arnoldd98

Posted

@jirimicvl will try that next time, thank you!

1

Please log in to post a comment

Log in with GitHub
Discord logo

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