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, CSS Flexbox

@Romina-Bonetto

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 there a best practice to center the whole content container on the center of the page (horizontal and vertical) without using "margin"? I tried with flexboox but ended up using margin also.

Community feedback

@Khawarmehfooz

Posted

Hi! 👋 Congratulations on completing the challenge!

I have some suggestions to improve the solution:

  • Add the following CSS properties to the body to properly center the content on the middle of screen:
height:100vh;
display: grid;
place-items:center:
  • Add the following CSS Properties to .attribution:
position:absolute;
bottom:0;

This will place the attribution in bottom.

Happy coding!

Marked as helpful

0

@Romina-Bonetto

Posted

@Khawarmehfooz thanks you for your help. Tried the attribution properties tip and it's great!

0
CodeBot 200

@Emperor-Shadow

Posted

When you use flexbox, you have to set the body's height to 100% of the viewport height Then the align items and justify content will work Just like this

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

And justify content is to center it horizontally whilst align items is to center it vertical. I wish you all the best Happy coding

Marked as helpful

0

@Romina-Bonetto

Posted

@Emperor-Shadow thanks for the feedback, it worked! Happy coding.

0
_nehal💎 6,710

@NehalSahu8055

Posted

instead of height : 100vh use min-height:100vh

0

@Romina-Bonetto

Posted

@NehalSahu8055 thank you for the advice!

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