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 using HTML and CSS

@naavemajid

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


During my project journey, l found it difficult to center my content exactly in the middle. whether l should use, position relative , position absolute, or just set margin auto on both sides and then specify some top margins as well.

With regards to this, l would love to hear from any of you on best practices for centering contents. Thank you.

Community feedback

@VickyAzola

Posted

Hi there! Great work finishing this challenge!

To center the card vertically and horizontally you can use grid or flex on the body:

with grid:

body { 
    min-height: 100vh;
    display: grid;
    place-content: center;
}

with flex:

body { 
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

Hope this helps!

1
Michal 10

@dopeboy321

Posted

You should try and learn about flexbox method :)

0

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