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 Grid, Flex and Media queries

@developerabz

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 tried building this QR component but had trouble getting it perfectly responsive across all screens. I ended up using media queries, alongside clamp, but is there a better way I could have done this? I feel as though I am using clamp incorrectly. Any other feedback is of course greatly appreciated.

Community feedback

@darrowv

Posted

Assalamu aleykum,

There is no reason to use clamp in this challenge. Just use width: 100% on img. Remove width and height from your main tag. And remove this img { max-width: calc(600px - 45px); }

Things such as fixed width and height are mainly just going against responsiveness.

Marked as helpful

1

@developerabz

Posted

@darrowv Walaykum Assalam!

Jazak Allahu Khairun, this really simplifies things. I did not know I could just set the width to 100%. I will be using this from now on haha.

1

@amalkarim

Posted

Hi Abdullah,

It's interesting. I didn't know that css clamp exists! It's surely nice to know that. Thanks.

Your solution is already great. Let me give you two suggestions only:

  • Remove height: 70vh; from main, as that could ruin the card design when the browser height is less than the card's height..
  • Give padding: 20px; or whatever pixel you prefer to the body to make the page nicer.

Hope this helps. Happy coding!

Marked as helpful

1

@developerabz

Posted

@amalkarim Hi Amal, This really fixed the height problem I was having on some devices. Thank you so much!

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