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 solution

@anthonyplicata

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 having a hard time keeping everything directly center in the webpage. I also feel that my html isn't technically accurate and would like to hear how I can make that better.

How could I have made the content stay in the center?

What would make my markup technically accurate?

Community feedback

@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.

CSS 🎨:

  • Looks like the component has not been centered properly. So let me explain, How you can easily center the component without using margin or padding.
  • We don't need to use margin and padding to center the component both horizontally & vertically. Because using margin or padding will not dynamical centers our component at all states
  • You already using Flexbox for layout, but you didn't utilized it's full potential. Just add the following rules to properly center the component.
body {
  justify-content-center;
}
  • Now remove these styles, after removing you can able to see the changes
.frame {
  margin: 0 auto;
}
  • Now your component has been properly centered

.

I hope you find this helpful 😄 Above all, the solution you submitted is great !

Happy coding!

Marked as helpful

1

@anthonyplicata

Posted

@0xAbdulKhalid Thanks so much! That advice is super helpful. I kept adding justify-content: center but was not doing anything, and I assume it was because I had too much going on with margin and padding for flexbox to really be used.

0

@0xabdulkhaliq

Posted

@anthonyplicata Glad you found it helpful ! 🤠

0

@AnoshaSohail

Posted

Hi! I've had the chance to review your code, and I wanted to share my thoughts with you. Overall, your work is quite impressive, and I can see the dedication and effort you've put into it. Below are a few approaches you could have used for easy centering body { min-height: 100vh; justify-content: center; } also remove the margin 0 auto from .frame

1

@anthonyplicata

Posted

@AnoshaSohail Thanks Anosha! I felt much better starting fresh with this second attempt. It seems like using margin and padding in .frame negates the potential of flexbox. Would you say that's correct?

0

@AnoshaSohail

Posted

@anthonyplicata Absolutely correct! Flexbox provides a powerful way to manage element layout and spacing directly, which can reduce the reliance on using margins and padding extensively. By utilizing flex properties effectively, you can achieve cleaner and more efficient layouts. Feel free to explore flexbox's features further. If you have any more questions, just let me know!

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