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 Flexbox

Alberto Ledesmaβ€’ 370

@ledesmx

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


Hello everyone.

This is my first challenge, I struggled a bit to center the whole content and I'm unsure if this is the correct way to center something inside the body tag.

Feel free to give me any feedback, I will appreciate it.

Community feedback

Abdul Khaliq πŸš€β€’ 72,660

@0xabdulkhaliq

Posted

Hello there πŸ‘‹. Congratulations on successfully completing the challenge! πŸŽ‰

  • I have other recommendations regarding your code that I believe will be of great interest to you.

BODY MEASUREMENTS πŸ“:

  • Use min-height: 100vh for body instead of height: 100vh. Setting the height: 100vh may result in the component being cut off on smaller screens.
  • For example; if we set height: 100vh then the body will have 100vh height no matter what. Even if the content spans more than 100vh of viewport.
  • But if we set min-height: 100vh then the body will start at 100vh, if the content pushes the body beyond 100vh it will continue growing. However if you have content that takes less than 100vh it will still take 100vh in space.

.

I hope you find this helpful πŸ˜„ Above all, the solution you submitted is great !

Happy coding!

Marked as helpful

0

Alberto Ledesmaβ€’ 370

@ledesmx

Posted

Hello Abdul Khalid,

Thank you for your valuable feedback, this is helpful for me.

0
Joshβ€’ 1,070

@josh76543210

Posted

Hi @AlbertoLed,

Great job on your solution!

Here are some recommendations for you (skip to the bottom if you just want the code πŸ˜‰):

First of all, I would remove the absolute positioning of the attribution and also the fixed height of the body. These will cause problems for users viewing your page on smaller screens such as on a mobile phone.

Next, add a min-heightof 100vh to the body. This is to replace the height we removed earlier. Also, add a flex-direction of column to position the attribution back underneath the container.

Lastly, I suggest adding a margin-top of auto to the container and the attribution. This will make sure everything is centered nicely.

Code to remove:

body {
  height: 100vh;
}

.attribution {
  position: absolute;
  bottom: 30px;
}

Code to add:

body {
  flex-direction: column;
  min-height: 100vh;
}

.container {
  margin-top: auto
}

.attribution {
  margin-top: auto
}

I hope this is helpful. Happy Coding!

Marked as helpful

0

Alberto Ledesmaβ€’ 370

@ledesmx

Posted

Hi Josh, Thanks for taking the time to give me feedback, I appreciate it.

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