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

@Andrej044

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


  • I'm using margin-top:auto for both section container and attribution for keeping the container in the center and attribution to the bottom of a body. Is this a good practice? -height: 100vh to the body, is this a good practice?
  • general remarks.

Thank's for your feedback!

Community feedback

Ferβ€’ 3,990

@fernandolapaz

Posted

Hi πŸ‘‹, regarding your question:

  • The page content could be centered using Grid or Flexbox (as you did πŸ‘), but it is better to use min-height: 100vh; for the body, as using height causes the page to be cut off in viewports with small height (such as mobile landscape orientation).

And I take the opportunity for another comment if you don't mind:

  • Be careful with using font-size: 10px in the root element as that trick is no longer commonly recommended because it can cause issues with accessibility and readability. Also, it’s good to get used to thinking directly in relative units like rem or em since they are the most suitable for most cases.

I hope it’s useful πŸ™‚

Regards,

Marked as helpful

1

@Kamlesh0007

Posted

Congratulations on completing the challenge! That's a great achievement, and I'm sure you put a lot of effort into it. I really liked the way you approached the challenge and the code you wrote. You demonstrated a good understanding of the concepts and applied them effectively to solve the problem.I have a few suggestions to improve your code further. When it comes to centering a div or any element on a webpage, using margins may not always be the best approach. so use flexbox or grid layout for centering the div. make the container center properly use min-height:100vh which is used to ensure that a container or element takes up at least the full height of the viewport (the visible area of the browser window) regardless of the content inside it.

Here's an example code snippet:

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

Marked as helpful

1

@Andrej044

Posted

@Kamlesh0007 Thanks for the feedback it's very helpful. But I'm curious how can I do attribution section on the bottom of the body without margin-top attribute.

0

@Kamlesh0007

Posted

@Andrej044 u can use postion fixed bottom:0

Marked as helpful

1

@Andrej044

Posted

@Kamlesh0007 Thank you so much for explaining. I'm very appreciated!

0

@Kamlesh0007

Posted

@Andrej044 thnx have u implemented it or not

0

@Kamlesh0007

Posted

@Kamlesh0007 yes u have Done it πŸ‘

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