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

Responsive Website with flexbox and fixed width

@Gaurab019

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 found it difficult to properly align the items without flexbox. I am not sure about media query so I had calculated the width of the QR code container and put in the same value for the smallest of screen size. For the larger resolution I just let the container have the same value. Please suggest if there is a better of doing this

Please have a look at my code and let me know how can I make it follow industry standards.

Community feedback

@M0hamedMagdy

Posted

Don't worry about centering items without flexbox. It's actually recommended to always use flex and grid systems. But you could also use "margin: 0 auto" on the card element with "width: 100% and height: 100vh" on the body and it will be centered.

You can use CSS relative units like "rems" which is relative to the ROOT font-size and then change it using CSS media queries. that will help you make it more responsive on different screens.

Or you can CSS percentages to let the browser do the calculations for you.

I would recommend web.dev "Learn Responsive Design". It will help you a lot

Marked as helpful

2

Lucas 👾 104,420

@correlucas

Posted

@M0hamedMagdy Nice tips I agree 100%.

0

@M0hamedMagdy

Posted

@correlucas Thank you <3

0

@Gaurab019

Posted

@M0hamedMagdy i tried using margin auto but then used a single div with display flex and height as100vh which was easy to use for centering

I have no experience using media query so i did some calculation and put in a fixed width

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